很简单的代码报出的异常,看来我有点晕了。
tyrbl 2007-08-13 01:27:45 如下很简单的代码报出了一个异常:
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].
请问:为什么会报出异常?如何调试?