oracle ORA-00911 问题 解决
书写sql语句
using (OracleConnection conn = new OracleConnection(OracleString)) { conn.Open(); var trans = conn.BeginTransaction(); string strsql = "insert into MYJYYZJ_print(STORECODE,CLS,NUM,LINE,FILDATE,CONTENT,STAT,LSTUPDTIME) values(:STORECODE,:CLS,:NUM,:LINE,:FILDATE,:CONTENT,:STAT,:LSTUPDTIME);"; try { for (int i = 0; i < contents.Count; i++) { OracleCommand com = new OracleCommand(); List<OracleParameter> pars = new List<OracleParameter>() { new OracleParameter("STORECODE",storeCode), new OracleParameter("CLS",title), //1 new OracleParameter("NUM", printNum), //2 new OracleParameter("LINE", i + 1), //3 new OracleParameter("FILDATE", DateTime.Now), //4 new OracleParameter("CONTENT",contents[i]), //5 new OracleParameter("STAT",10), //6 new OracleParameter("LSTUPDTIME", DateTime.Now) //7 }; PrepareCommand(com, conn, trans, CommandType.Text, strsql, pars.ToArray()); if (com.ExecuteNonQuery() <= 0) throw new TangJiuBusinessException("插入错误"); com.Parameters.Clear(); } trans.Commit(); return true;
一直报异常 错误消息为ORA-00911 无效字符 然后搜索了好多 结果又说sql语句的末尾多了个分号(“;”)的原因 抱着试试的心态去掉 后 一切正常
奇怪 plsql中也不报错啊
折腾了一上午,无语!!
我要我的自我!