0
我正在使用Datatable.select,以獲取一些數據。我的代碼如下:Datatable.select不會返回主數據表中的所有列
for (int j=0; j<NStations.Count();j++)
{
var result= DailyWeatherData.Select("StationName ='" + NStations[j]["StationName"] + "' and Monthh>='" + SP_Biofix.Month + "' and Monthh<='" + SP_DATE.Month + "'").CopyToDataTable();
foreach (DataRow row in result.Rows)
{
WeatherData.ImportRow(row);
}
}
於是我下令使用下面的代碼:
WeatherData = WeatherData.AsEnumerable()
.OrderBy(r => r.Field<string>("StationName"))
.CopyToDataTable();
這給了我以下錯誤:
the column "stationName" does not belong to datatable.
這是否意味着我需要使用datatable.where?我在其他地方錯了嗎?