How can I connect a dbf file in .net ?


C

Chuen

I want to open a dbf file in vb.net,how can I do it?

Regards
Chuen
 
Ad

Advertisements

P

Paul Clement

¤ I want to open a dbf file in vb.net,how can I do it?
¤
¤ Regards
¤ Chuen
¤

See if the following helps:

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 dBaseCommand As New System.Data.OleDb.OleDbCommand("SELECT * FROM MyDBase",
dBaseConnection)
Dim dBaseDataReader As System.Data.OleDb.OleDbDataReader =
dBaseCommand.ExecuteReader(CommandBehavior.SequentialAccess)

While dBaseDataReader.Read
Console.WriteLine(dBaseDataReader("Column1").ToString)
Console.WriteLine(dBaseDataReader("Column2").ToString)
Console.WriteLine(dBaseDataReader("Column3").ToString)
End While

dBaseConnection.Close()


Paul ~~~ (e-mail address removed)
Microsoft MVP (Visual Basic)
 
Ad

Advertisements

G

Guest

I have had very good success with ODBC. Set up the database directory under
System DSN. All your connection string has to say is "DSN=XXX"
 

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

Similar Threads


Top