当我在“USER1”之间放置双引号时,如何摆脱oracleCommand错误 我需要使用下面的查询为我的oracleCommand和USER1有双引号和C#认为我的命令只有USER1,但它实际上“选择.....”USER1“.......双重”。
using (OracleCommand crtCommand = new OracleCommand("SELECT REGEXP_REPLACE ( REPLACE ( dbms_metadata.get_ddl ('PROCEDURE', 'HELL_'), '"USER1".'),'^\s+', NULL, 1, 0, 'm') FROM dual", conn2))
如何修改如下
using (OracleCommand crtCommand = new OracleCommand(@"SELECT REGEXP_REPLACE ( REPLACE ( dbms_metadata.get_ddl ('PROCEDURE', '+ Items +'), '"" + txtSrcUserID.Text.ToUpper() + "".'),'^\s+', NULL, 1, 0, 'm') FROM dual", conn1))
答案 0 :(得分:0)
使用“@”处理Verbatim String Literals,如下所示:
using (OracleCommand crtCommand = new OracleCommand(@"SELECT REGEXP_REPLACE ( REPLACE ( dbms_metadata.get_ddl ('PROCEDURE', 'HELL_'), '""USER1"".'),'^\s+', NULL, 1, 0, 'm') FROM dual", conn2))