Skip to Main Content

Oracle Database Discussions

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

ORA-00911: invalid character with C# .NET project

2714462Jul 22 2014 — edited Sep 17 2014

I have a C# project I'm working on in Visual Studio 2013 Express. I build a query string based on a bunch of structural calculations and that all works great. When I build the query it looks like this:

SQLCommand.CommandText"INSERT INTO BAAN.ttdfab100800 (T$EITM,T$DSCA,T$DSCB,T$DSCC,T$DSCD,T$WGHT,T$SEAK,T$SEAB,T$EIGP,T$PRDR,T$CPRJ,T$DREF,T$CTYP,T$CSEL,T$CSIG,T$ENGI,T$DRFM,T$UNOM,T$USET,T$CUNI,T$OPOL,T$CITG,T$KITM,T$TXTA,T$STAT,T$USER,T$TRDT,T$TRTM,T$ERRO,T$REFCNTD,T$REFCNTU) VALUES ('8010701','TPS HATCH','ALUM','54X58','STD',64.67,'TPS54X58ACDN','EHS','801',1,'Prj','A','C10','CSE','CSI',178,'B',1,'   ALL','ea',1,'801001',2,0,1,'MyUserId',to_date('22-07-2014','dd-mm-yyyy'),0,'0',0,0);"string

The trouble is that when I execute this query the Oracle client reports back this error:

ex.ToString()"Oracle.DataAccess.Client.OracleException ORA-00911: invalid character    at Oracle.DataAccess.Client.OracleException.HandleErrorHelper(Int32 errCode, OracleConnection conn, IntPtr opsErrCtx, OpoSqlValCtx* pOpoSqlValCtx, Object src, String procedure, Boolean bCheck)\r\n   at Oracle.DataAccess.Client.OracleException.HandleError(Int32 errCode, OracleConnection conn, String procedure, IntPtr opsErrCtx, OpoSqlValCtx* pOpoSqlValCtx, Object src, Boolean bCheck)\r\n   at Oracle.DataAccess.Client.OracleCommand.ExecuteNonQuery()\r\n   at TPS_BOM_02_.Write2BAAN.Write2Baan() in c:\\0\\Misc\\Junk\\20140720TPS_BOM(03)\\TPS_BOM(02)\\Write2BAAN.cs:line 277"string


However, I can copy the query above from the watch window in Visual Studio, remove only the extraneous test to leave just what's between the quotes, then paste this into Toad and run it and the record will be entered into the Oracle database. So I have to believe the syntax is correct. But it will not run from the C# program.


We've ported this over to MySQL and it works perfect there. The app we're working with is BAAN and it uses Oracle for it's backend. The version of the Oracle Server is 11g and we're using the x86 Oracle client for Visual Studio. I've carefully checked that I'm using the correct types for each column. And since the same query will run in Toad, I have to believe the syntax is correct. Still I keep hitting this road block of C# reporting an invalid character. BTW, I've setup Toad to use the exact same Oracle client that we're using in Visual Studio.

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Oct 15 2014
Added on Jul 22 2014
1 comment
5,142 views