Framework1.1时正常运行,现升级到Framework2.0出现此错误,大家帮我看一下。
COrder_List类中异常:The acceptable values for the property 'QuotePrefix' are '[' or '"'. 
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: dbclass.ClassCallException: COrder_List类中异常:The acceptable values for the property 'QuotePrefix' are '[' or '"'.Source Error: 
Line 65:  Current_Page = 1;
Line 66:  }
Line 67:  int TotalRec=m_Order_List.Get_Record_Num(query);
Line 68:  //输出分页信息
Line 69:  if((TotalRec%MaxPerPage)!=0)
 以下是相关代码:
    使用代码:
         int TotalRec=m_Order_List.Get_Record_Num(query);   类代码:
       public int Get_Record_Num(string stj)//获取符合条件stj的记录总数
         {
             string sSqlTj=stj;
             if (sSqlTj.Length ==0)
             {
                    sSqlTj="select count(*) as TotalRec from Ad_List";
             }
             else
             {
                    sSqlTj="select count(*) as TotalRec from Ad_List where " + stj;
             }
             try
             {
                  if (m_cn.State!=ConnectionState.Open)
                  {
                       m_cn.ConnectionString =m_ConnString.ConnString;
                       m_cn.Open();
                   }
                   mySqlDataAdapter = new SqlDataAdapter(sSqlTj,m_cn);
                   SqlCommandBuilder custCB = new SqlCommandBuilder(mySqlDataAdapter);
                   custCB.QuotePrefix ="[";
                   custCB.QuotePrefix ="]";
                   myDataSet = new DataSet();
                   mySqlDataAdapter.MissingSchemaAction = MissingSchemaAction.AddWithKey;
                   mySqlDataAdapter.Fill(myDataSet,"Ad_List");
                   iRowCount = Convert.ToInt32(myDataSet.Tables["Ad_List"].Rows[0]["TotalRec"]);
                   return iRowCount;
             }
             catch(Exception e)
             {
                 throw new dbclass.ClassCallException ("CAd_List类中异常:"+e.Message);
             }
         }

解决方案 »

  1.   

    asp.net夜话之七:ADO.NET介绍
    ADO.NET是对Microsoft ActiveX Data Objects (ADO)一个跨时代的改进,它提供了平台互用性和可伸缩的数据访问。由于传送的数据都是XML格式的,因此任何能够读取XML格式的应用程序都可以进行数据处理。事实上,接受数据的组件不一定要是ADO .NET组件,它可以是基于一个Microsoft Visual Studio的解决方案,也可以是任何运行在其它平台上的任何应用程序。以前做数据库访问的时候,需要一直与数据库保持连接,直到获取完所有满足需要的数据之后才会断开数据库连接,这种数据库访问方式称之为连接式数据访问技术。相比于以前的连接式数据访问技术,ADO.NET除了提供连接式数据访问技术之外,还提供了另一种断开式解决方案,那就是在内存中模拟一个数据库,也就是内存中的数据库。我们知道在实际的数据库技术中,每个数据库就是一个业务逻辑单元,一般来说这个数据库包含了实现一个应用软件或者一个网站所需要的全部数据。
    本篇中还讲述了自定义分页在数据库层的理论。
      

  2.   

    //实例化Connection对象 
            SqlConnection connection = new SqlConnection("Data Source=(local);Initial Catalog=AspNetStudy;Persist Security Info=True;User ID=sa;Password=sa"); 
            //实例化Command对象 
            SqlCommand command = new SqlCommand("select count(1) as 男性人数 from UserInfo where sex=1", connection); 
            //打开Connection对象 
            connection.Open(); 
            //执行SQL语句 
            int count = int.Parse(command.ExecuteScalar().ToString()); 
            //关闭Connection对象 
            connection.Close(); 
            Response.Write("在UserInfo表里共有" + count + "个男性。");用Command对象的command.ExecuteScalar()方法吧。
      

  3.   

    怎么两次都是给custCB.QuotePrefix设值啊?
    custCB.QuotePrefix ="]"; 
    应该改为
    custCB.QuoteQuoteSuffix ="]"; 
    吧,是笔误还是怎么的?