通过使用oledb操作oracle数据库,成功实现图片上传到blob类型的字段,但有时会发生ora-01036错误的问题,经查询是错误提示为illegal variable name/number,不知道有谁能详细解释illegal variable name/number的意思
oracle data provider for .net
hi
i am using odp.net (oracle data provider for .net) in my asp.net application.
i have a table in my oracle database called "equipmentgroup". when the page loads for the first time i retrieve all the records from the table to a dataset and save it to viewstate. later on any addition or modification is done in the dataset only in disconnected mode. finally,when user clicks update i call this function "update" which should do a batch update but instead it gives the following error :
"ora-01036: illegal variable name/number "
private void update()
{
oracleparameter workparam;
oracleconnection cnn = new oracleconnection("data source=neeleshr;user id=tmse; password=tmse;");
string sql = "insert into equipmentgroup (code, description, lifetime, priamrylife, grading, inflator, extensionrate, maintenancefee) values (:code, :description, :lifetime, :priamrylife, :grading, :inflator, :extensionrate, :maintenancefee)";
oraclecommand cmd = new oraclecommand(sql,cnn);
cmd.commandtype = commandtype.text;
oracledataadapter da = new oracledataadapter();
da.insertcommand = cmd;
workparam = da.insertcommand.parameters.add("code",oracletype.char,10,"code");
workparam.sourceversion = datarowversion.current;
workparam = da.insertcommand.parameters.add("description",oracletype.varchar,50,"description");
workparam.sourceversion = datarowversion.current;
workparam = da.insertcommand.parameters.add("lifetime",oracletype.number);
workparam.sourcecolumn = "lifetime";
workparam.sourceversion = datarowversion.current;
workparam = da.insertcommand.parameters.add("priamrylife",oracletype.number);
workparam.sourcecolumn = "priamrylife";
workparam.sourceversion = datarowversion.current;
workparam = da.insertcommand.parameters.add("grading",oracletype.char,10,"grading");
workparam.sourceversion = datarowversion.current;
workparam = da.insertcommand.parameters.add("inflator",oracletype.number);
workparam.sourcecolumn = "inflator";
workparam.sourceversion = datarowversion.current;
workparam = da.insertcommand.parameters.add("extensionrate",oracletype.number);
workparam.sourcecolumn = "extensionrate";
workparam.sourceversion = datarowversion.current;
workparam = da.insertcommand.parameters.add("maintenancefee",oracletype.number);
workparam.sourcecolumn = "maintenancefee";
workparam.sourceversion = datarowversion.current;
try
{
da.update(ds,"equipmentgroup");
}
catch(exception e)
{
message.text = e.message;
}
}
hi,
i think that you should add parameters with ":" included, like:
workparam =
da.insertcommand.parameters.add(":code",oracletype.char,10,"code");
oledb data provider for .net
string sql = "insert into equipmentgroup (code, description, lifetime, priamrylife, grading, inflator, extensionrate, maintenancefee) values (?, ?, ?, ?, ?, ?, ?, ?, )";
hi,
i think that you should add parameters with ":" included, like:
workparam =
da.insertcommand.parameters.add(":code",oracletype.char,10,"code");
