在C#程序中调用带参数的存储过程 报错
我想在程序中调用带参数的存储过程,EXECDS_IE.PR_HM_BILLINSERT('D4D54B71390E4A3391744F4389EE4ACA','43214...
我想在程序中调用带参数的存储过程,
EXEC DS_IE.PR_HM_BILLINSERT ('D4D54B71390E4A3391744F4389EE4ACA','43214342','二极管',423,'121',4321,'234','0110','E','2014/8/25','201408001054325','053','14','日本','','')
这样执行 为什么报无效SQL语句? 展开
EXEC DS_IE.PR_HM_BILLINSERT ('D4D54B71390E4A3391744F4389EE4ACA','43214342','二极管',423,'121',4321,'234','0110','E','2014/8/25','201408001054325','053','14','日本','','')
这样执行 为什么报无效SQL语句? 展开
2个回答
展开全部
看看你的C#调用语句?
//执行存储过程
command = new SqlCommand( "GetDeliverItem ", connection);
//说明命令要执行的是存储过程
command.CommandType = CommandType.StoredProcedure;
//向存储过程中传递参数
command.Parameters.Add(new SqlParameter( "@SampCode ", SqlDbType.VarChar, 30));
command.Parameters.Add(new SqlParameter( "@DeptName ", SqlDbType.VarChar, 100));
command.UpdatedRowSource = UpdateRowSource.None;
command.Parameters[ "@SampCode "].Value = sampCode;
command.Parameters[ "@DeptName "].Value = combSelDeliver.Text.ToString();
//执行命令
dapt.SelectCommand = command;
dapt.SelectCommand.ExecuteNonQuery();
dapt.Fill(dataSet, "test ");
dataView.Table = dataSet.Tables[ "test"];
dataGridView1.DataSource = dataSet.Tables[ "test"];
//执行存储过程
command = new SqlCommand( "GetDeliverItem ", connection);
//说明命令要执行的是存储过程
command.CommandType = CommandType.StoredProcedure;
//向存储过程中传递参数
command.Parameters.Add(new SqlParameter( "@SampCode ", SqlDbType.VarChar, 30));
command.Parameters.Add(new SqlParameter( "@DeptName ", SqlDbType.VarChar, 100));
command.UpdatedRowSource = UpdateRowSource.None;
command.Parameters[ "@SampCode "].Value = sampCode;
command.Parameters[ "@DeptName "].Value = combSelDeliver.Text.ToString();
//执行命令
dapt.SelectCommand = command;
dapt.SelectCommand.ExecuteNonQuery();
dapt.Fill(dataSet, "test ");
dataView.Table = dataSet.Tables[ "test"];
dataGridView1.DataSource = dataSet.Tables[ "test"];
更多追问追答
追问
EXEC DS_IE.PR_HM_BILLINSERT (:P_LIST_NO,:P_CODE_T,:P_G_NAME,:P_DEC_PRICE)
return DBAL.Helper.Execute(cmd, pars); //pars中是传的参数
追答
既然是这样,你自己跟踪到 DBAL.Helper.Execute 中,看看 在实际调用 sql语句时,当时的代码到底是什么?!
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询