EROR插入数据 [英] EROR in Inserting data

查看:73
本文介绍了EROR插入数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

System.Data.SqlClient.SqlException(0x80131904):@ showComplaint不是过程sp_InsertEmployee的参数。

at System.Data.SqlClient.SqlConnection.OnError(SqlException exception,Boolean breakConnection)<在System.Data.SqlClient的System.Data.SqlClient.SqlInternalConnection.OnError(SqlException异常,布尔breakConnection)上的

在System.Data.SqlClient的System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning()处的
.TdsParser.Run(RunBehavior runBehavior,
SqlCommand cmdHandler,SqlDataReader dataStream,BulkCopySimpleResultSet bulkCopyHandler,TdsParserStateObject stateObj)

at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior,String resetOptionsString)

在System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior,RunBehavior runBehavior,Boolean returnStream,Boolean async)

在System.Data。 SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehav ior,RunBehavior runBehavior,Boolean returnStream,String方法,DbAsyncResult结果)

at System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(DbAsyncResult result,String methodName,Boolean sendToPipe)

在System.Data.SqlClient.SqlCommand.ExecuteNonQuery()

在DAL_d2v.SqlHelper.ExecuteNonQuery(SqlConnection连接,CommandType commandType,String commandText,SqlParameter [] commandParameters)

in D:\ ASP_D2V_pro \DAL \DAL_d2v \ SQLHelper.cs:第375行

在DAL_d2v.SqlHelper.ExecuteNonQuery(CommandType commandType,String commandText,SqlParameter [] commandParameters)
$ b中的b $ b:\ ASP_D2V_pro \ DAL \ DAL_d2v \ SQLHelper.cs:第262行

at BAL_d2v.EmployeeMasterBal.InsertEmployee()在D:\ ASP_D2V_pro \ BAL \ BAL_d2v\EmployeeMasterBal.cs:第56行

at EmployeeMaster.btn_Insert_Click(Object sender,EventArgs e)

in c:\ Users \ bhavin \Docu ments\Visual Studio 2010 \WebSites\ASP_D2V\EmployeeMaster.aspx.cs:第121行

System.Data.SqlClient.SqlException (0x80131904): @showComplaint is not a parameter for procedure sp_InsertEmployee.
at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection)
at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection)
at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning() at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior,
SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)
at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString)
at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async)
at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result)
at System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(DbAsyncResult result, String methodName, Boolean sendToPipe)
at System.Data.SqlClient.SqlCommand.ExecuteNonQuery()
at DAL_d2v.SqlHelper.ExecuteNonQuery(SqlConnection connection, CommandType commandType, String commandText, SqlParameter[] commandParameters)
in D:\ASP_D2V_pro\DAL\DAL_d2v\SQLHelper.cs:line 375
at DAL_d2v.SqlHelper.ExecuteNonQuery(CommandType commandType, String commandText, SqlParameter[] commandParameters)
in D:\ASP_D2V_pro\DAL\DAL_d2v\SQLHelper.cs:line 262
at BAL_d2v.EmployeeMasterBal.InsertEmployee() in D:\ASP_D2V_pro\BAL\BAL_d2v\EmployeeMasterBal.cs:line 56
at EmployeeMaster.btn_Insert_Click(Object sender, EventArgs e)
in c:\Users\bhavin\Documents\Visual Studio 2010\WebSites\ASP_D2V\EmployeeMaster.aspx.cs:line 121

推荐答案

看起来它无法与参数@showComplaint匹配sp_InsertEmployee参数。检查拼写是否正确。如果你有多个数据库,那么检查你是否正在连接到正确的数据库。
Looks like its not able to match paramater @showComplaint with sp_InsertEmployee paramaters. Check the spelling if its proper. If you are having multiple databases then check you are connecting to the right one.


使用System.Data.SqlClient;

public SqlConnection con;

public SqlCommand cmd;



//插入编码

con = new SqlConnection(strcon);

con.Open();

cmd = new SqlCommand(Insert into Tablename values('+ field1 +','+ field2 +'),con);

cmd.ExecuteNonQuery();

con.Close();

检查上面的编码。
using System.Data.SqlClient;
public SqlConnection con;
public SqlCommand cmd;

//Insert Codings
con = new SqlConnection(strcon);
con.Open();
cmd = new SqlCommand("Insert into Tablename values('" + field1 + "','" + field2 + "')", con);
cmd.ExecuteNonQuery();
con.Close();
check it the above codings.


这篇关于EROR插入数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆