Access数据库连接
采用OleDbConnection对象
代码 1
Private Function getAccessConnection() As OleDbConnection
Dim dbConnectionString As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=|DataDirectory|/Resources/mag.mdb;Persist Security Info=true"
Dim dbConnection As OleDbConnection = New OleDbConnection(dbConnectionString)
Try
dbConnection.Open()
Catch Ex As Exception
'MsgBox(Err.Description)
End Try
Return dbConnection
End Function
代码 2
private Sub fillDataGridView()
Dim sqlStr As String = "select * from Table"
Dim DataAdapter As New OleDbDataAdapter
Dim dataSet As New DataSet
Dim DataGridView As New DataGridView
Dim dbConnect
采用OleDbConnection对象
代码 1
Private Function getAccessConnection() As OleDbConnection
Dim dbConnectionString As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=|DataDirectory|/Resources/mag.mdb;Persist Security Info=true"
Dim dbConnection As OleDbConnection = New OleDbConnection(dbConnectionString)
Try
dbConnection.Open()
Catch Ex As Exception
'MsgBox(Err.Description)
End Try
Return dbConnection
End Function
代码 2
private Sub fillDataGridView()
Dim sqlStr As String = "select * from Table"
Dim DataAdapter As New OleDbDataAdapter
Dim dataSet As New DataSet
Dim DataGridView As New DataGridView
Dim dbConnect