C# Datatable.select不';t返回主数据表中的所有列

C# Datatable.select不';t返回主数据表中的所有列,c#,linq,datatable,C#,Linq,Datatable,我正在使用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 +

我正在使用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);
    }
}
for(int j=0;j r.Field(“StationName”))
.CopyToDataTable();
这给了我以下错误:

列“stationName”不属于datatable


这是否意味着我需要使用datatable.where?我在其他地方错了吗?

我通过替换以下循环来回答我的问题:

foreach (DataRow row in result.Rows)
   {
    WeatherData.ImportRow(row);
    }
使用以下代码:

WeatherData = WeatherData.AsEnumerable()
                         .OrderBy(r => r.Field<string>("StationName"))
                         .CopyToDataTable();
 WeatherData.BeginLoadData(); 
                            WeatherData.Merge(result); 
                            WeatherData.EndLoadData();