Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Must Declare Scalar Variable run time error
Message
Information générale
Forum:
ASP.NET
Catégorie:
Code, syntaxe and commandes
Divers
Thread ID:
01472783
Message ID:
01472817
Vues:
32
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 = ?";
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform