LeafSqlCommand = New SqlCommand("Select * from TableMember where 会员姓名= '" & TextBox1.Text & "'", LeafSqlConnection) 你这句是不是写错了啊
LeafSqlCommand = New SqlCommand("Select * from TableMember where 会员姓名= “ & ”‘“ & tBox1.Text & "'", LeafSqlConnection)
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim oledb1 As New OleDb.OleDbConnection
Dim ServerIP as string="127.0.0.1"
oledb1.ConnectionString = "Provider=SQLOLEDB;Data Source=" + ServerIP + ";Initial Catalog=VIPcardDatabase 3;User ID=sa;Password=asd"
oledb1.Open()
If ConnectionState.Open Then
Dim ssql As String
ssql = "Select * from TableMember"
Dim MyAdapter As New OleDb.OleDbDataAdapter(ssql, oledb1)
Dim MyTable As New DataTable()
MyAdapter.Fill(MyTable)
DataGridView1.DataSource = MyTable
oledb1.Close()
'MsgBox("查询成功")
End If
End Sub