Private Sub 查询Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles 查询Button.Click
Dim testCheck1 As Boolean
Dim testCheck2 As Boolean
testCheck1 = CheckBox1.Checked
testCheck2 = CheckBox2.Checked
If testCheck1 = True Then
Dim MySQLConnectionString As String = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=|DataDirectory|\****.accdb;Jet OLEDB:Database Password=*****"
Dim MyConnection As New System.Data.OleDb.OleDbConnection(MySQLConnectionString)
MyConnection.Open()
Dim MyTable As New Data.DataTable()
Dim MySQL As String = "select * from 学生管理
where (姓名= '" + Me.姓名TextBox.Text + "')"
Dim MyAdapter As New OleDbDataAdapter(MySQL, MyConnection)
MyAdapter.Fill(MyTable)
Me.学生管理DataGridView.DataSource = MyTable
If (MyConnection.State = ConnectionState.Open) Then
MyConnection.Close()
End If
Else
同理
End If
End Sub