几个小问题希望各位大哥可以帮小弟解释下 1、查询多个字段: select id,OrderNumber,BuyerAccount,BuyerName,OrderAmout,CommodityMoney,Payment,OrderTime,Supplier,Logistics,OrderLogistics FROM OrderTable where OrderNumber like '%" + ASPxTextBox1.Text + "%' and OrderLogistics like '%" + ASPxComboBox1.Text + "%' and Logistics like '%" + ASPxComboBox2.Text + "%' and BuyFrom like '%" + ASPxComboBox3.Text + "%' and BuyerAccount like '%" + ASPxTextBox2.Text + "%'and BuyerName like '%" + ASPxTextBox3.Text + "%'and Supplier like '%" + ASPxComboBox8.Text+ "%' and huodaofukuan like '%" + ASPxComboBox6.Text + "%' and Payment like '%" + ASPxComboBox7.Text + "%' and OrderTime between '" + ASPxDateEdit1.Text + "' and '" + ASPxDateEdit2.Text + "' and Sphone like '%" + ASPxTextBox6.Text + "%' and Sname like '%" + ASPxTextBox7.Text + "%' and OrderLook IS null
------解决方案-------------------- 首先你要说下这里出现什么问题吧,什么都不说怎么解决那,简单的失效会有很多种的,你把sql语句里面的between and放在最后试下
------解决方案-------------------- Like 最好这么写 select * from tb where xx like @parm;
parameters.add("@param","'%xx%'");
------解决方案-------------------- 晕,写错了,应该是 parameters.add("@param","%xx%");
------解决方案-------------------- select id,OrderNumber,BuyerAccount,BuyerName,OrderAmout,CommodityMoney,Payment,OrderTime,Supplier,Logistics,OrderLogistics FROM OrderTable where OrderNumber like '%" + ASPxTextBox1.Text + "%' and OrderLogistics like '%" + ASPxComboBox1.Text + "%' and Logistics like '%" + ASPxComboBox2.Text + "%' and BuyFrom like '%" + ASPxComboBox3.Text + "%' and BuyerAccount like '%" + ASPxTextBox2.Text + "%'and BuyerName like '%" + ASPxTextBox3.Text + "%'and Supplier like '%" + ASPxComboBox8.Text+ "%' and huodaofukuan like '%" + ASPxComboBox6.Text + "%' and Payment like '%" + ASPxComboBox7.Text + "%' and OrderTime between '" + ASPxDateEdit1.Text + "' and '" + ASPxDateEdit2.Text + "' and Sphone like '%" + ASPxTextBox6.Text + "%' and Sname like '%" + ASPxTextBox7.Text + "%' and OrderLook IS null
------解决方案--------------------