0

我有一个要分配选择查询的数据表。但是会弹出以下错误:“语法错误:'TruckGrossWeight'运算符后缺少操作数。”

DataRow[] drs = dataTableForDropDowns
 .Select("LNGFuelAvailability=" + drpdwnlst_LNGFuelAvailability.SelectedValue + " " +
         "TruckGrossWeight=" + drpdwnlst_TruckGrossCombinedWeight.SelectedValue + "");

选定值 ( int ) 的值是:

drpdwnlst_LNGFuelAvailability.SelectedValue= 5
drpdwnlst_TruckGrossCombinedWeight.SelectedValue = 2
4

1 回答 1

1

试试下面

DataRow[] drs = dataTableForDropDowns.Select("LNGFuelAvailability = "+drpdwnlst_LNGFuelAvailability.SelectedValue+ " AND TruckGrossWeight = "+drpdwnlst_TruckGrossCombinedWeight.SelectedValue);

语法应如下所示

DataRow[] results = table.Select("A = foo AND B = bar");

或者

DataRow[] results = table.Select("A = foo OR B = bar");
于 2014-10-24T15:57:05.550 回答