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 Answer 1

2

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();
Sign up to request clarification or add additional context in comments.

2 Comments

I believe Good Charlotte put it best: "Its the little things, the little things, that always bring you down. Thanks! :D
sheesh - that was my first thought, but I tossed that out thinking: nah, it can't be that obvious and simple :-(

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.