BlitzData 1.1 R7

Miscellaneous Forums/Blitz Showcase/BlitzData 1.1 R7

Reading DBF files using BlitzData

Exported one table from Access to create the DBF file.
Created a table named:
Db5.dbf

To get my connect string I went here:

http://www.able-consulting.com/ADO_Conn.htm

Table of contents, ODBC DSN-Less, ODBC Driver for dBASE
and got the following:

oConn.Open "Driver={Microsoft dBASE Driver (*.dbf)};" & _
"DriverID=277;" & _
"Dbq=c:\somepath"

I dropped connection syntax on left and converted to single string:

"Driver={Microsoft dBASE Driver (*.dbf)};DriverID=277;Dbq=D:\Program Files\Blitz3D\BlitzData 1.0;Exclusive=No"

The Following code worked great:

Graphics 800,600,32,2
SetBuffer BackBuffer()

t% = BD_OpenDatabase("Driver={Microsoft dBASE Driver (*.dbf)};DriverID=277;Dbq=D:\Program Files\Blitz3D\BlitzData 1.0;Exclusive=No","","","",4)
If t = -1 Then
  Text 20,20,"Could not open database."
  Flip
  key = WaitKey()
  End
Else
  Text 20,20,"Opened TEST database Successfully."
  Flip
  While Not GetKey():Wend
EndIf

t = BD_SQLQuery("SELECT * FROM Db5 ")
If t = 0 Then
  Text 20,40, "Opened recordset successfully"
  Flip
EndIf

reccount = BD_ColumnCount()

Text 20,60, "Columns in table Db5: " + Str(reccount)

BD_CloseQuery()

t = BD_SQLQuery("SELECT * FROM DB5 ORDER BY NAME")
If t = 0 Then
  Text 20,80, "Opened recordset successfully"
  Flip
EndIf

For t = 1 To BD_RecordCount()
  Text 20, 80 + (t * 20), BD_GetColumn("NAME") 
  BD_NextRecord()
  Flip
  WaitKey()
Next

BD_CloseQuery()
BD_CloseDatabase()
While Not GetKey():Wend