By using oledb to operate the Oracle database, the image is successfully uploaded to the Blob type field, but sometimes the problem of ORA-01036 error occurs, the query is the error prompt is illegal variable name/number, I don't know who can explain illegal variable name/number in detail
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 shocould 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, maintenancees) 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 ("maintenance.pdf", 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 shoshould 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, maintenance)) values (?, ?, ?, ?, ?, ?, ?, ?, )";
Hi,
I think that you shoshould add parameters with ":" included, like:
Workparam =
Da. insertcommand. Parameters. Add (": code", oracletype. Char, 10, "Code ");