小编Fab*_*elz的帖子

VB.Net中的sqlParameters数组

我正在尝试在VB.Net中创建一个类型大小的参数数组:

Dim parameters() As SqlParameter = New SqlParameter() _
        {
          New SqlParameter("@first_name", SqlDbType.VarChar, 50) {Value = "john"},
          New SqlParameter("@last_name", SqlDbType.VarChar, 50) {Value = "doe"},
          New SqlParameter("@age", SqlDbType.Int) {Value = 18},
          New SqlParameter("@id", SqlDbType.Int) {Value = 123}
        }
Run Code Online (Sandbox Code Playgroud)

但VS说:价值'没有宣布.由于其保护级别,它可能无法访问

上面的代码有什么问题?

谢谢!

vb.net arrays sqlparameter

3
推荐指数
1
解决办法
1万
查看次数

使用ApplicationException

我想知道ApplicationException当用户违反某些业务规则时,是否建议使用它来返回应用程序错误.例如:

public void validate(string name, string email)
{   
    int count1 = (from p in context.clients
        where (p.name == clients.name)
        select p).Count();

    if (count1 > 0)
        throw new ApplicationException("Your name already exist in the database");

    int count2 = (from p in context.clients
        where (p.email == clients.email)
        select p).Count();

    if (count2 > 0)
        throw new ApplicationException("Your e-mail already exist in the database"); 
}
Run Code Online (Sandbox Code Playgroud)

这是一个好的或坏的策略?如果不是,那会是更好的方法?

c# asp.net asp.net-mvc design-patterns

2
推荐指数
2
解决办法
7830
查看次数

在Visual Studio 2015中使用正则表达式查找和替换

在我的源代码中,使用Visual Studio 2015我想将特定文件夹中的所有javascript调用替换为其最小化文件名.例如:

<script type="text/javascript" src="~/Scripts/common/filename1.js"></script>
<script type="text/javascript" src="~/Scripts/common/filename2.js"></script>
<script type="text/javascript" src="~/Scripts/common/filename3.js"></script>
Run Code Online (Sandbox Code Playgroud)

我想替换为:

<script type="text/javascript" src="~/Scripts/common/filename1.min.js"></script>
<script type="text/javascript" src="~/Scripts/common/filename2.min.js"></script>
<script type="text/javascript" src="~/Scripts/common/filename3.min.js"></script>
Run Code Online (Sandbox Code Playgroud)

我使用以下表达式:

在此输入图像描述

我应该在"替换为"字段中添加什么?

regex visual-studio

1
推荐指数
1
解决办法
974
查看次数