Error in Insertion of Record in Database

  • Thread starter Thread starter simsimlhr
  • Start date Start date
S

simsimlhr

When I Compile The code given below.The exception comes Having Message
as follows .
Error:System.Data.SqlClient.SqlError:Prepare statement '(@id
varchar(10))Insert Into Student values('12')expects parameter
@id,which was not supplied.


FurtherMore I have connected with Sql Server 2000.Table Name is
Student,Field is only id.which is varchar.
Just Drags the Table from server explorer in the form .It makes
variable automatically.I write the code using those variables.Code is
as follows


private System.Data.SqlClient.SqlCommand sqlInsertCommand1;
sqlInsertCommand1.CommandText="Insert Into Student values ('12')";
sqlInsertCommand1.ExecuteNonQuery();


Please Someone Reply what is the cause of error. :?:
I will be thankful
Qasim Raza
 
Hello mate,

You typically get this error when you're calling a stored procesdure and don't supply one of the parameters that the stored procedure requires. Are you sure it's a table and not a stored procedure?

Jon
 
Back
Top