Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DBF database with CDX indexes

Status
Not open for further replies.

Monsores

Technical User
Mar 4, 2002
39
BR
Hi.
I´m starting with ODBC and would like to know how to access a DBF database with CDX indexes. I tried the WinXP ODBC drivers, but they only let me open DBF with NDX indexes, not NTX or CDX ones.

Thanks a lot

PS: sorry if the question seems stupid, but I never user ODBC before. :)
 
Hello MadMaxRj,

I got an emergency call from someone yesterday who has an old DOS xBase system (.dbf's, .ndx's and .dbt's) which no longer runs since they upgraded to Windows XP. Would you be kind enough to post some code regarding opening up a DBF with an NDX file as you mention in your post? Many Thanks!

Have a great day!

j2consulting@yahoo.com
 
Hello SBendBuckeye,
Altough I asked about ODBC+DBF, I'm not using it. I found a better solution called ADS (Advantage Database Server) that can handle my old DBF files as a Database Server. I does not have as many resources as Oracle for example, but can be easily accessed via Clipper or other languages, like Delphi and PHP, for example.
But I also have older DOS applications running with xBase under WinXP, and I didn´t have to change anything when I move from Win98.
If you can tell me the error messages are you getting, I can try to help you. Couldn´t it be the "Set Clipper" value under DOS enviroment?

Regards,
Marcelo
 
I was referring to this line from your original post:

I tried the WinXP ODBC drivers, but they only let me open DBF with NDX indexes, not NTX or CDX ones.

How did you open a DBF file with an NDX index using ODBC? At this point I am just trying to get the files open so I can see about retrieving their data. Thanks for the quick response!


Have a great day!

j2consulting@yahoo.com
 
i am trying to connect to DBF files using VB code does anyone have a code that does this
 
anyes1:-

I am trying to the same thing but can't achieve it.
I have found a connection string and made an error free connection but the recordset goes into EOF state as if it is an empty file.

If you have got anywhere let me know please.
I have a folder with two .dbf files and two .cdx files but
I am unable to read any data out of them. I have no prior knowledge of .dbf files so I might be doing something dumb.

My code is as follows to identify the fields in the database:-

'
' Dimension Variables & Objects
Dim objRecordSet01 As ADODB.Recordset
Dim objConnection As ADODB.Connection
Dim strCurrentTable As String
Dim StrNewTable As String
Dim strConnection As String


Private Sub Form_Load()
'
' Set Up The Connection & Open It
Set objRecordSet01 = New ADODB.Recordset
Set objConnection = New ADODB.Connection
strConnection="Driver={Microsoft Visual FoxPro Driver};" & _
"SourceType=DBF;" & _
"SourceDB=c:\Hiremate Files\;" & _
"Exclusive=No;"

objConnection.Open strConnection

'
' Open Schema Definition
Set objRecordSet01=objConnection.OpenSchema(adSchemaColumns)

'
' Initialise
strCurrentTable = ""
StrNewTable = ""

'
' Read Through RecordSet
Do Until objRecordSet01.EOF
strCurrentTable = objRecordSet01!TABLE_NAME
If (strCurrentTable <> StrNewTable) Then
StrNewTable = objRecordSet01!TABLE_NAME
Debug.Print "Table: " & objRecordSet01!TABLE_NAME
End If

Debug.Print "Field: " & objRecordSet01!COLUMN_NAME
objRecordSet01.MoveNext
Loop

objRecordSet01.Close
Set objRecordSet01 = Nothing
objConnection.Close
Set objConnection = Nothing


End Sub


Dazed and confused
 
SBendBuckeye:-

your connection string site doesn't exist?

Dazed and confused
 
Can anybody tell me how I can read a free foxpro table using VB?

I have two .dbf files that exist in a directory with corresponding .CDX files. How can I read them using VB without using a .dbc container file?

Do I have to specifically name the .dbf in the ODBC somehow or is it something that you select in VB?

Dazed and confused
 
Skittle,

Here's the vb code I use to open an ODBC connection to a .dbf file.

Add Microsoft ActiveX Data Object 2.7 to your project refernce.

Dim db As New ADODB.Connection

db.ConnectionString = _
"Driver={Microsoft Visual FoxPro Driver};" & _
"SourceType=DBF;" & _
"SourceDB=c:\foxpro_stuff;" & _
"Exclusive=No"

db.Open

db.Close
Set db = Nothing

In the connection string, you should set the SourceDB property to the folder containing your .dbf file. In this case, the .dbf file I'm accessing is in C:\foxpro_stuff.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top