2010年10月13日 星期三

Open an OleDB Connection

要撈資料,就從這裡開始吧.



Imports oledb = System.Data.OleDb

Private Sub InitializeAccessDatabase()
Dim connOleDb As oledb.OleDbConnection
Dim dataSource As String

dataSource = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Application.StartupPath & "\xxx.mdb"

If connOleDb Is Nothing Then
connOleDb = New oledb.OleDbConnection(dataSource)
End If

If connOleDb.State <> ConnectionState.Open Then
connOleDb.Open()
End If

_conn = connOleDb
End Sub

沒有留言:

張貼留言