Parameterized OleDb Command for Oracle to execute in C#

Recently, when writing into an oracle database from C# using OleDbConnection I kept running into some of the gibberish errors that Oracle keeps throwing.
My Insert Query looks something like this, 

"INSERT INTO TableA (Col1, Col2, Col3) Values ?, ?, ?;"

Just in case anybody is wondering, the adding Question marks is the way to parameterize oracle queries for C#/VB. First strange error I kept getting was  ORA-00947 not enough values. I kept counting my columns and values and just did not seem incorrect. Of course then I noticed my all important parenthesis that are missing.
so, my query is now changed to "INSERT INTO TableA (Col1, Col2, Col3) Values (?, ?, ?);"

Onto adding the OleDbParameters with Values to the Parameter Collection and Voila, my codes start working.

So much for these errors Oracle throws that makes very little sense.

Comments

Popular posts from this blog

Testing PDF forms with merge code fields - let's just build a tool

Dynamics CRM implementation: lessons learnt

Moving data? Integrating systems? Right ETL tool is your best friend