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