各位大虾 帮帮忙了
程序如下:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim sql As String = "SELECT * FROM 图书信息表 where "
If ComboBox1.SelectedIndex > 0 Then
str += ComboBox1.Items(ComboBox1.SelectedIndex)
End If
If TextBox1.Text > "" Then
str += " like'" & TextBox1.Text & "%';"""
Try
Me.SqlConnection1.Open()
Me.SqlDataAdapter1.SelectCommand = New SqlClient.SqlCommand(sql + str, SqlConnection1)
Me.DataSet11.Clear()
Me.SqlDataAdapter1.Fill(DataSet11, "图书信息表")
DataGrid1.DataSource() = Me.DataSet11.Tables("图书信息表")
Catch ex As Exception
End Try
运行了一下 没有错误 可是没办法执行查询阿
我 原来是想用combobox1中选中 的内容查的
可是。。。。。