How can we connect to Microsoft Access, Foxpro , Oracle etc ?
The Microsoft provides System.Data.OleDb namespace to communicate with the databases such as Oracle, scess etc. In brief any OLE DB-Compliant database can be connected using the System.Data.OldDb namespace.
Private Sub loadData()
Dim strPath As String
strPath = AppDomain.CurrentDomain.BaseDirectory
Dim objOLEDBCon As New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source =" & strPath & "Nwind.mdb")
Dim objOLEDBCommand As OleDbCommand Dim objOLEDBReader As OleDbDataReader Try
objOLEDBCommand = New OleDbCommand("Select FirstName from Employees")
objOLEDBCon.Open() objOLEDBCommand.Connection = objOLEDBCon objOLEDBReader = objOLEDBCommand.ExecuteReader() Do While objOLEDBReader.Read()
lstNorthwinds.Items.Add(objOLEDBReader.GetString(0)) Loop
Catch ex As Exception
Throw ex
Finally objOLEDBCon.Close()
End Try
End Sub