public static int ExecuteNonQuery(string connectionString, CommandType cmdType, string cmdText, params SqlParameter[] commandParameters){
SqlCommand cmd = new SqlCommand();
using (SqlConnection conn = new SqlConnection(connectionString)){
PrepareCommand(cmd, conn, null, cmdType, cmdText, commandParameters);
int val = cmd.ExecuteNonQuery();
cmd.Parameters.Clear();
return val;
}
}
谁能给解释下这句:PrepareCommand(cmd, conn, null, cmdType, cmdText, commandParameters);
------解决方案--------------------------------------------------------
这句话是设置cmd 对象的连接的 可以根据参数设置 命令类型。参数等