日期:2014-05-18 浏览次数:20592 次
Dim cnn As New SqlConnection((New ConnectionString().ConnectionInfo))
Dim sql As String
sql = "select * from caigouwuliaoziliao_table where 1=1"
If RadioButton2.Checked = True Then
sql = sql + "and shenhe=1"
End If
If RadioButton3.Checked = True Then
sql = sql + "and shenhe=0"
End If
If textbox1.Text <> "" Then
sql = sql + "and biaodan_no='" & textbox1.Text + "'"
End If
If TextBox2.Text <> "" Then
sql = sql + "and wuliao_no='" & TextBox2.Text + "'"
End If
If TextBox3.Text <> "" Then
sql = sql + "and baojia_no='" & TextBox3.Text + "'"
End If
If TextBox4.Text <> "" Then
sql = sql + "and kehu='" & TextBox4.Text + "'"
End If
If TextBox5.Text <> "" Then
sql = sql + "and sbmc='" & TextBox5.Text + "'"
End If
If TextBox6.Text <> "" Then
sql = sql + "and wlmc='" & TextBox6.Text + "'"
End If
If ComboBox1.Text <> "" Then
sql = sql + "and gys='" & ComboBox1.Text + "'"
End If
------解决方案--------------------
这种应该很好实现的,比如 如果是下拉选择框,前端程序可以判断选择框里面是否有选择选项,若有选择项,则相应增加where子句后面的筛选条件。并且,淘宝应该会做自动筛选,比如你先选择了产品分类(男装),下面的产品子类应该会自动筛选(你就不会再选中女士skirt)。