Writing SQL statements
using(OracleConnection conn =NewOracleConnection (oraclestring)) {Conn. Open (); vartrans =Conn. BeginTransaction (); stringstrSQL ="INSERT INTO Myjyyzj_print (Storecode,cls,num,line,fildate,content,stat,lstupdtime) VALUES (: Storecode,:cls,:num ,: line,:fildate,:content,:stat,:lstupdtime);"; Try { for(inti =0; I < contents. Count; i++) {oraclecommand com=NewOracleCommand (); List<OracleParameter> Pars =NewList<oracleparameter>() { NewOracleParameter ("Storecode", Storecode),NewOracleParameter ("CLS", title),//1 NewOracleParameter ("NUM", Printnum),//2 NewOracleParameter (" Line", i +1),//3 NewOracleParameter ("fildate", DateTime.Now),//4 NewOracleParameter ("CONTENT", Contents[i]),//5 NewOracleParameter ("STAT",Ten),//6 NewOracleParameter ("Lstupdtime", DateTime.Now)//7 }; PrepareCommand (COM, conn, trans, CommandType.Text, strSQL, pars. ToArray ()); if(COM. ExecuteNonQuery () <=0) Throw NewTangjiubusinessexception ("Insert Error"); Com. Parameters.clear (); } trans.commit (); return true;
Always reported the exception error message is ORA-00911 invalid character and then searched for a lot of results and said the end of the SQL statement more than a semicolon (";") The reason for holding a try to remove all normal after the mentality
The strange plsql also does not have the error.
Tossing the whole morning, without words!!
Oracle ORA-00911 Problem Solving