By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,631 Members | 1,873 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,631 IT Pros & Developers. It's quick & easy.

How do I read and update DbaseIII files.

P: n/a
Hi, the problem I have is that an older dos program is using dbase 3 or 4
database files and I wish to add a little utility that scanns this database,
and if specific record has a certain entry (flag) i wish to extract all of
the records for this entry change the flag in the dbase file and write it
into a new mdb database. The second part is no problem, i can hook into mdb
databases and do all that stuff, but I cannot seem to create a proper
connection with a dbase file.

Problem: How do I set a connection corectly with a sample.dpf sample.ndx,
and read and write records into this dataset.

Any help would be great
Nov 20 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Hi,

It has been a while since I opened a dbase file. You do it the same
as with access but use this as the connection string
"Provider=Microsoft.Jet.OLEDB.4.0;Data Source= directory with dbase files;
Extended Properties=DBase III;". To open sample.dpf use this as your sql
statement. Select * from sample. Hope this helps.

Ken
-------------------
"Frank" <frank> wrote in message
news:up**************@TK2MSFTNGP12.phx.gbl...
Hi, the problem I have is that an older dos program is using dbase 3 or 4
database files and I wish to add a little utility that scanns this database, and if specific record has a certain entry (flag) i wish to extract all of
the records for this entry change the flag in the dbase file and write it
into a new mdb database. The second part is no problem, i can hook into mdb databases and do all that stuff, but I cannot seem to create a proper
connection with a dbase file.

Problem: How do I set a connection corectly with a sample.dpf sample.ndx,
and read and write records into this dataset.

Any help would be great

Nov 20 '05 #2

P: n/a
I can import a dBase 5 table to a datatable in a dataset.
No idea if this works for older versions.

================================================== =========
strSQL = "SELECT * FROM [" & dBaseTableName & "]"
If strFileFormat = "dBase 5.0" Then
strConn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & strPath &
";Extended Properties=""dBase 5.0"""
End If

Dim obj As New DAL(strConn)
obj.FillTable(dsMain, strTableName, strSQL, "OLEDB")
================================================== =========
In my DAL (data access layer) I have a FillTable method:
================================================== =========
Public Sub FillTable(ByRef ds As DataSet, ByVal TableName As String, ByVal
strSQL As String, ByVal DBtype As String)
If DBtype = "SQL Server" Then
'do something
ElseIf DBtype = "Oracle" Then
'do something
ElseIf DBtype = "OLEDB" Then
Dim da As OleDbDataAdapter
Dim cnn As New OleDbConnection(mConnStr)
Dim cmd As New OleDbCommand(strSQL, cnn)
Try
cmd.CommandType = CommandType.Text
cnn.Open()
da = New OleDbDataAdapter(cmd)
da.Fill(ds, TableName)
Catch exc As Exception
Throw exc
Finally
cnn.Close()
End Try
End If
End Sub
================================================== =========
--
Joe Fallon

"Frank" <frank> wrote in message
news:up**************@TK2MSFTNGP12.phx.gbl...
Hi, the problem I have is that an older dos program is using dbase 3 or 4
database files and I wish to add a little utility that scanns this database, and if specific record has a certain entry (flag) i wish to extract all of
the records for this entry change the flag in the dbase file and write it
into a new mdb database. The second part is no problem, i can hook into mdb databases and do all that stuff, but I cannot seem to create a proper
connection with a dbase file.

Problem: How do I set a connection corectly with a sample.dpf sample.ndx,
and read and write records into this dataset.

Any help would be great

Nov 20 '05 #3

P: n/a
Hi Frank,

You can access dbase files as datatables etc just as any other ado .net
object if you use the odbc provider for .net. If you have vs .net 2003 you
have it and need only set the correct import statements; if an earlier
version, you can download it and install it from msdn.microsoft.com.

HTH,

Bernie Yaeger

"Frank" <frank> wrote in message
news:up**************@TK2MSFTNGP12.phx.gbl...
Hi, the problem I have is that an older dos program is using dbase 3 or 4
database files and I wish to add a little utility that scanns this database, and if specific record has a certain entry (flag) i wish to extract all of
the records for this entry change the flag in the dbase file and write it
into a new mdb database. The second part is no problem, i can hook into mdb databases and do all that stuff, but I cannot seem to create a proper
connection with a dbase file.

Problem: How do I set a connection corectly with a sample.dpf sample.ndx,
and read and write records into this dataset.

Any help would be great

Nov 20 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.