Update error

  • Thread starter Thread starter RS
  • Start date Start date
R

RS

I have below code and i get the following error when i run it...
Procedure 'StoredProcedure1' expects parameter '@ID', which was not
supplied.
Am i setting parameters wrong?
Thank you all very much!!

OleDbDataAdapter daSqlDb = new OleDbDataAdapter("select * from dude",
m_conSqlDb);
OleDbCommand cmdSQL = new OleDbCommand("StoredProcedure1",m_conSqlDb);
cmdSQL.Parameters.Add( "@ID",OleDbType.VarChar,10,"ID");
cmdSQL.Parameters.Add("@Name",OleDbType.VarChar,10,"Name");
cmdSQL.Parameters.Add("@Size",OleDbType.VarChar,10,"Size");
daSqlDb.UpdateCommand = cmdSQL;
daSqlDb.InsertCommand = cmdSQL;
// daSqlDb.DeleteCommand = cmdSQL;
try
{
daSqlDb.Update(dsOleTextDb, "dude");
}
catch(Exception e)
{
Console.Write(e.Message);
}
 
Which is your database?

If it is sqlserver, you need "@ID" instead of "ID" in the 3rd parameter of
cmdsql.parameters.add("@ID, oledbtype.varchar, 10, "ID") statements.

Rajesh Patel
 
Back
Top