我有一个数据表,我想分配选择查询。但是会弹出以下错误:"语法错误:在&TruckHrossWeight'之后缺少操作数。操作"
DataRow[] drs = dataTableForDropDowns
.Select("LNGFuelAvailability=" + drpdwnlst_LNGFuelAvailability.SelectedValue + " " +
"TruckGrossWeight=" + drpdwnlst_TruckGrossCombinedWeight.SelectedValue + "");
所选值的值( int )是:
drpdwnlst_LNGFuelAvailability.SelectedValue= 5
drpdwnlst_TruckGrossCombinedWeight.SelectedValue = 2
答案 0 :(得分: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");