"ORA-00936: missing _expression" vs Parameters.Add

  • Thread starter Thread starter Pool_Shark
  • Start date Start date
P

Pool_Shark

I am using Parameters.Add to my OleDb.OleDbCommand as follows.

cmd.Parameters.Add("@ListName", TextBox1.Text)
cmd.Parameters.Add("@OutputFile", TextBox2.Text)

It works beautifully with MS Access and SQL Server. But, I am now
getting an error of "ORA-00936: missing _expression" when I am
applying it to Oracle database. For some reason, Oracle does not
like the use of parameters in SQL statement. My SQL statement is
shown in the debug mode as below.

insert into table_name
values(@param1, @param2)
where column1, column2

On the debug mode, the value of @param1 = "test1", and the value of
@param2 = "test2".
I checked Oracle SQL syntax and found nothing missing or wrong with
this statement. Could somebody tell me what I might have done wrong
here? Thanks again for your advice.
 
Pool_Shark said:
cmd.Parameters.Add("@ListName", TextBox1.Text)
cmd.Parameters.Add("@OutputFile", TextBox2.Text)

cmd.Parameters.Add("ListName", TextBox1.Text)
cmd.Parameters.Add("OutputFile", TextBox2.Text)
insert into table_name
values(@param1, @param2)
where column1, column2

insert into table_name
values(:param1, :param2)
where column1, column2

I recommend that you use database-specific providers whenever possible.
The Microsoft Oracle provider, or Oracle's ODP provider are both better
than the OleDb provider when you use Oracle.

Eric
 
Back
Top