M
mp
No value given for one or more required parameters.
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information
about the error and where it originated in the code.
Exception Details: System.Data.OleDb.OleDbException: No value given for one
or more required parameters.
Source Error:
Line 68:
Line 69: myCommand.Connection.Open();
Line 70: myCommand.ExecuteNonQuery();
Hi,
I have one problem with No value given for one or more required parameters
error.
I am using OleDb connection, C# and ASP.NET
I have used Edit controls (txtID, txtLName)...
Code is following:
....
String insertCmd = "insert into Authors (au_id, au_lname, au_fname, phone,
address, city, state, zip, contract) values (@Id, @LName, @FName, @Phone,
@Address, @City, @State, @Zip, @Contract)";
OleDbCommand myCommand = new OleDbCommand(insertCmd, thisConnection);
myCommand.Parameters.Add(new OleDbParameter("@Id", OleDbType.VarChar, 11));
myCommand.Parameters["@Id"].Value = txtID.Text;
/*Server.HtmlEncode(txtID.Text);*/
myCommand.Parameters.Add(new OleDbParameter("@LName", OleDbType.VarChar,
40));
myCommand.Parameters["@LName"].Value = txtLName.Text; /*
Server.HtmlEncode(txtLName.Text); */
myCommand.Connection.Open();
myCommand.ExecuteNonQuery();
I am not sure what is wrong and why this error has occured?
Thanks
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information
about the error and where it originated in the code.
Exception Details: System.Data.OleDb.OleDbException: No value given for one
or more required parameters.
Source Error:
Line 68:
Line 69: myCommand.Connection.Open();
Line 70: myCommand.ExecuteNonQuery();
Hi,
I have one problem with No value given for one or more required parameters
error.
I am using OleDb connection, C# and ASP.NET
I have used Edit controls (txtID, txtLName)...
Code is following:
....
String insertCmd = "insert into Authors (au_id, au_lname, au_fname, phone,
address, city, state, zip, contract) values (@Id, @LName, @FName, @Phone,
@Address, @City, @State, @Zip, @Contract)";
OleDbCommand myCommand = new OleDbCommand(insertCmd, thisConnection);
myCommand.Parameters.Add(new OleDbParameter("@Id", OleDbType.VarChar, 11));
myCommand.Parameters["@Id"].Value = txtID.Text;
/*Server.HtmlEncode(txtID.Text);*/
myCommand.Parameters.Add(new OleDbParameter("@LName", OleDbType.VarChar,
40));
myCommand.Parameters["@LName"].Value = txtLName.Text; /*
Server.HtmlEncode(txtLName.Text); */
myCommand.Connection.Open();
myCommand.ExecuteNonQuery();
I am not sure what is wrong and why this error has occured?
Thanks