当前位置: 代码迷 >> .NET Framework >> 很简单的代码报出的错误,看来小弟我有点晕了
  详细解决方案

很简单的代码报出的错误,看来小弟我有点晕了

热度:24   发布时间:2016-05-02 00:50:03.0
很简单的代码报出的异常,看来我有点晕了。
如下很简单的代码报出了一个异常:  
DataSet   ds   =   new   DataSet( "FirstDataSet ");
                        //ds.Tables.Add( "dt ");  
                        DataTable   dt   =   new   DataTable( "table1 ");
                        DataColumn   price   =   new   DataColumn( "column1 ",   typeof(System.Int32));
                        DataColumn   count   =   new   DataColumn( "column2 ",   typeof(System.Int32));
                        dt.Columns.Add(price);
                        dt.Columns.Add(count);
           
                        DataColumn   agg   =   new   DataColumn( "column3 ",   typeof(System.Int32));
                        agg.Expression   =   "count*price ";
                        dt.Columns.Add(agg);   //   在此报出了异常:Cannot   find   column   [count].

请问:为什么会报出异常?如何调试?

------解决方案--------------------
  相关解决方案