码迷,mamicode.com
首页 > 数据库 > 详细

oracle ORA-00911 问题 解决

时间:2015-04-27 15:11:47      阅读:142      评论:0      收藏:0      [点我收藏+]

标签:

 

书写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中也不报错啊

折腾了一上午,无语!!

oracle ORA-00911 问题 解决

标签:

原文地址:http://www.cnblogs.com/xingbo/p/4460073.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!