Hi Viv. Thanks for reply.
I tried without the parameters and it worked fine.
Also, I changed the driver from OleDB to Sql and that worked fine with the parameters...dont know why I initially had it as OLEDB
Regards,
Gerard
>>Hi.
>>I am getting a run time error with tthe following code:(Must declare scalarVariable "@TranType")
>>
>>string table;
>>table ="MyTable";
>>
>>string txtUpdate = "Update " + table + " SET FIELD1=FIELD2 WHERE TRANTYPE = @TranType";
>>OleDbCommand sqlUpdate = new OleDbCommand(txtUpdate, dbConn);
>>sqlUpdate.Parameters.Add("@TranType", OleDbType.VarWChar, 10);
>>sqlUpdate.Parameters["@TranType"].Value = "INVOICE";
>>sqlUpdate.ExecuteNonQuery();
>
>I don't think the Oledb provider supports named parameters. Try:
string txtUpdate = "Update " + table + " SET FIELD1=FIELD2 WHERE TRANTYPE = ?";