好吧,我很好奇如果我传递一些没有@
符号的参数会发生什么
public static int Run(string command,string anotherParameter, DataTable dt)
{
SqlDataAdapter adapter = new SqlDataAdapter("SPName", Connection.Connect);
adapter.SelectCommand.CommandType = CommandType.StoredProcedure;
adapter.SelectCommand.Parameters.Add("@command",SqlDbType.NVarChar).Value=command;
//another one without @
adapter.SelectCommand.Parameters.Add("anotherParameter",SqlDbType.NVarChar).Value=anotherParameter;
try
{
return adapter.Fill(dt);
}
catch (Exception ex)
{
return -1;
}
finally
{
adapter.Dispose();
}
}
这可能有时会运行而另一个失败?
谢谢