Data Connections into dBase files

T

Tomek

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?
Tomek
 
V

Val Mazur

Hi,

What you could do is to use Jet 4.0 provider or ODBC provider. In a case of
Jet 4.0 provider, you need to use .NET OLEDB Managed Provider. In a case of
ODBC, you would need to install ODBC .NET provider, which is not a part of
the VS.NET. See next link with the samples of the connection strings

http://www.able-consulting.com/ADO_Conn.htm
 
P

Paul Clement

¤ 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)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top