11-14-2008, 10:17 AM
This is example for mysql. Connects to local MySQL server as user 'root' (it is default user), password 'p' (you set it in MySQL server instance config wizard), and selects initial database 'menagerie'. Then shows contents of table 'pet'.
Macro
You need Connector/ODBC - MySQL ODBC driver.
http://dev.mysql.com/downloads/
If you have driver version 3.51, replace 5.1 to 3.51.
To connect to a remote database (if the web server allows it and you know all the parameters) can be used code like this:
Macro
Macro
Database db.Open("DRIVER={MySQL ODBC 5.1 Driver};DATABASE=menagerie;USER=root;PASSWORD=xxxx;")
ARRAY(str) a; int r c
db.QueryArr("SELECT * FROM pet" a)
for r 0 a.len(2)
,out "-- Record %i --" r+1
,for c 0 a.len(1)
,,out a[c r]
You need Connector/ODBC - MySQL ODBC driver.
http://dev.mysql.com/downloads/
If you have driver version 3.51, replace 5.1 to 3.51.
To connect to a remote database (if the web server allows it and you know all the parameters) can be used code like this:
Macro