dBase and ASP.NET

  • Thread starter Thread starter Jerome Schnitzler
  • Start date Start date
J

Jerome Schnitzler

Hello NG,

I need your help. I have to access a dBase file through ASP.NET. I would do
that with ODBC.NET but somebody told me that this is also possible with
OleDb. Well I would like to do that with OleDb but have no idea how. Would
somebody like to tell me a solution for that?

Bye

Jerome
 
¤ Hello NG,
¤
¤ I need your help. I have to access a dBase file through ASP.NET. I would do
¤ that with ODBC.NET but somebody told me that this is also possible with
¤ OleDb. Well I would like to do that with OleDb but have no idea how. Would
¤ somebody like to tell me a solution for that?
¤

Below is an example using the Jet OLEDB provider (dBase file name is MydBase):

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

'Bind to DataGrid
DataGrid1.SetDataBinding(ds, "MydBase")

'List rows in DataTable
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)
 
¤ Any chance that the dBase file could have a different extension (rather than .dbf) and still could be read this way??

Not that I am aware of. I've seen various suggestions but none have worked when using the dBase
driver. If there was ever a workaround, it is not available in Jet 4.0.

One suggestion I haven't tried is using the Visual FoxPro OLEDB driver instead of the dBase ISAM and
Jet OLEDB.


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