Problems with uploading images to BLOB fields using Oracle databases

Source: Internet
Author: User

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 ");

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.