tags:

views:

732

answers:

1
DbCommand command = new OracleCommand(
       "insert into hardware (HardwareID) VALUES (6);", myConnection);
command.ExecuteNonQuery();

Hardware is a NUMBER(7, 0).

I am trying to make this simple Oracle INSERT work using C#. However, I keep getting an 911 error saying that there is an invalid character.

What am I doing wrong?

I can execute the following code without problems:

DbCommand command2 = new OracleCommand("Select * from Hardware", myConnection);
command2.ExecuteReader();

(I plan on using parameters later, I am just trying to get a proof-of-concept built)

+1  A: 

I believe you can't add the ';' at the end. So try:

DbCommand command = new OracleCommand(
       "insert into hardware (HardwareID) VALUES (6)", myConnection);
command.ExecuteNonQuery();
Timothy Carter
I believe Good Charlotte put it best: "Its the little things, the little things, that always bring you down. Thanks! `:D`
jjnguy
sheesh - that was my first thought, but I tossed that out thinking: nah, it can't be *that* obvious and simple :-(
marc_s
grrr...it's the obvious things that really (pardon) fuck me up.
jjnguy