Reputation: 373
I am trying to insert these values:
int limit = 50000;
int acc_id = 1;
string query = "INSERT INTO CURRENT_ACCOUNT(C-ACCOUNT_NO,DAILY_LIMIT)
VALUES ('"+acc_id+"','"+limit+"')";
OracleCommand command = new OracleCommand(query, con);
command.ExecuteNonQuery();
But getting a missing comma exception:
C# {"ORA-00917: missing comma"}
Upvotes: 2
Views: 792
Reputation: 64959
Are you sure your CURRENT_ACCOUNT
table contains a column with the name C-ACCOUNT_NO
? Is the column named C_ACCOUNT_NO
(with the dash -
replaced with an underscore _
) instead?
If the column name genuinely does contain a dash, wrap the column name in double-quotes:
string query = "INSERT INTO CURRENT_ACCOUNT(\"C-ACCOUNT_NO\",DAILY_LIMIT) " + // ...
Upvotes: 1
Reputation: 2246
You have to add semicolon at the end of query..
string query = "INSERT INTO CURRENT_ACCOUNT(C-ACCOUNT_NO,DAILY_LIMIT)
VALUES ("+acc_id+","+limit+");";
Upvotes: 0