int val = cmd.ExecuteNonQuery();总是提示'='附近有语法错误,该怎么解决?
publicstaticintExecuteNonQuery(stringconnectionString,CommandTypecmdType,stringcmdTex...
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; }} 展开
{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; }} 展开
1个回答
展开全部
返回值类型是int吗?如果不是把val定义成和返回值一致的类型。
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询