试了一下,代码
Dim sql As String = "select * from titles where 0=0"
If DropDownList1.SelectedItem.Text <> "请选择" Then
sql += "and name='" + DropDownList1.SelectedItem.Text + "'"
End If
If DropDownList2.SelectedItem.Text <> "请选择" Then
sql += "and type='" + DropDownList2.SelectedItem.Text + "'"
End If
用了一个textbox来看结果
TextBox1.Text = sql