Yes this should work on Vista.
ODBC is the Microsoft Database Layer, so it would be seriously bad if it doesn't , but i did not test (successfully tested on 2K, XP, 2K3 Server).
Once MyODBC is installed, you have to configure (manually or programmaticaly) a database connection.
for that, follow instructions :
1/
start -> execute -> odbcad32.exe
2/
make sure you have MySQL ODBC 3.51 Driver in 'ODBC Driver' page
3/
system data source -> add -> select MyODBC
4/
Data Source Name = test
Description =
Server = localhost (or external hosts/IP but make sure port 3306 is opened, so check your firewall and mysql user/rights)
User = root
Password =
Database = mysql
5/
click on 'test' button to check if connection is ok
6/
ok your odbc connection is ready, now let's see what to do inside purebasic
7/
just execute this sample :
Code: Select all
;-------------------------------------------------------------------------
; Database Exemple for PureBasic 4.2x.
; This minimalist example require a 'test' data source.
; Data source must be first configured in the ODBC manager (odbcad32.exe).
;-------------------------------------------------------------------------
; Initialize the ODBC engine
If UseODBCDatabase()
; Connect to the MySQL database
If OpenDatabase(0, "test", "root", "")
; Execute a SQL query
If DatabaseQuery(0, "SELECT help_topic_id, name FROM mysql.help_topic")
; Fetching rows
While NextDatabaseRow(0)
Debug GetDatabaseString(0, 0) + " ==> " + GetDatabaseString(0, 1)
Wend
Else
MessageRequester("Error", "DatabaseQuery() failed !" + #CRLF$ + DatabaseError())
EndIf
; Once fetching done, closing opened database.
CloseDatabase(0)
Else
MessageRequester("Error", "OpenDatabase() failed !" + #CRLF$ + DatabaseError())
EndIf
Else
MessageRequester("Error", "UseODBCDatabase() failed !")
EndIf
End