首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > C# >

ORA-01000: 超出打开游标的最大数! 在线急等!解决思路

2013-08-09 
ORA-01000: 超出打开游标的最大数!! 在线急等!staticvoid Main(string[] args){DateTime begin DateTime

ORA-01000: 超出打开游标的最大数!! 在线急等!
   static  void Main(string[] args)
        {
            DateTime begin = DateTime.Now;
            OracleDataReader odr = null;
            OracleConnection conn = null;
            int i = 0;
            for (int j = 0; j < 10;j++ )
            {

                try
                {
                    Console.WriteLine("start");      
                    string connsql = "Data Source=(DESCRIPTION =" + "(ADDRESS = (PROTOCOL = TCP)(HOST = 129.129.129.16)(PORT = 1521))" + "(CONNECT_DATA =(SERVER = DEDICATED)(SERVICE_NAME = orcl) ) );" + "User ID=tcyb_sjqy;PassWord=tcyb_sjqy;Unicode=True";
                    conn = new OracleConnection(connsql);//创建一个新连接?
                                      
                    conn.Open();
                    OracleCommand cmd = conn.CreateCommand();
                    cmd.CommandText = "select t.jtbh,t.xm,t.ylzh, t.rowid from yw_cb_grjbzl t   where t.yzbm is null  ";//在这儿写sql语句?              
                    odr = cmd.ExecuteReader();



                    Console.WriteLine("Conn 已经打开");
                    while (odr.Read())
                    {
                        String YLZH = odr.GetOracleString(2).ToString();                     
                        cmd.CommandText = "update  yw_cb_grjbzl t set t.yzbm = '" + MathExample.GetStrMiWen(YLZH) + "' where t.ylzh = '" + YLZH + "'";   //MathExample.GetStrMiWen(YLZH) 此处调用了个加密算法
                        cmd.ExecuteReader();
                        Console.WriteLine(i++);

                    }
                    cmd.Dispose();
                    odr.Dispose();
                    conn.Dispose();
                    
                    odr.Close();
                    conn.Close();

                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex);
                }


                finally
                {
                    odr.Close();
                    conn.Close();
                }
            }
            TimeSpan ts = DateTime.Now - begin;
            Console.WriteLine("ts = " + ts.TotalMilliseconds);
            Console.ReadKey();

        }
执行到299 就报“System.Data.OracleClient.OracleException: ORA-01000: 超出打开游标的最大数” 的错误  ,忘各位大虾能给解决下 ,新手求指点!!最好能给个成功的例子!!谢谢!!

[解决办法]


while (odr.Read())
{
....
   //cmd.ExecuteReader();
   cmd. ExecuteNonQuery();
....
}

[解决办法]
 while (odr.Read())
                    {
                        String YLZH = odr.GetOracleString(2).ToString();                     
                        cmd.CommandText = "update  yw_cb_grjbzl t set t.yzbm = '" + MathExample.GetStrMiWen(YLZH) + "' where t.ylzh = '" + YLZH + "'";   //MathExample.GetStrMiWen(YLZH) 此处调用了个加密算法


                        cmd.ExecuteReader(); cmd.ExecuteNonQuery();
                        Console.WriteLine(i++);

                    }

热点排行