¤ Hi,
¤ Please help me with Data Connections into dBase files.
¤ I have catalog with lot of files like *.dbf and *.mdx . Every file contains
¤ one table (I can see it in MS Access).
¤ How can I make connections into this/that folder/files in VB.NET project?
Below is an example that uses the Jet OLEDB provider and dBase ISAM driver:
'Establish a connection to the data source.
Dim ConnectionString As String
ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=e:\My Documents\dBase;Extended Properties=dBase IV"
Dim dBaseConnection As New System.Data.OleDb.OleDbConnection(ConnectionString)
dBaseConnection.Open()
Dim da As New System.Data.OleDb.OleDbDataAdapter("Select * from MyDBase", dBaseConnection)
Dim ds As New DataSet("dBaseTables")
da.Fill(ds, "MydBase")
Dim dt As DataTable
dt = ds.Tables("MydBase")
DataGrid1.SetDataBinding(ds, "MydBase")
Dim drCurrent As DataRow
For Each drCurrent In dt.Rows
Console.WriteLine("{0} {1}", _
drCurrent("Column1").ToString, _
drCurrent("Column2").ToString)
Next
dBaseConnection.Close()
Paul ~~~ (e-mail address removed)
Microsoft MVP (Visual Basic)