ScriptBasic > Tutorials
MySQL & ODBC Examples
(1/1)
Support:
I thought I would post a couple quick examples of using the MySQL C API and ODBC extension modules with ScriptBasic.
--- Code: MySQL ---include "C:\scriptbasic\include\mysql.bas" dbh = mysql::RealConnect("host","user","password","DB") mysql::query(dbh,"SELECT * FROM bible WHERE word_name LIKE 'am%'") WHILE mysql::FetchHash(dbh, column) PRINT LEFT(column{"word_name"} & STRING(30," "),30),column{"word_count"},"\n" WEND mysql::Close(dbh)
--- Code: Text ---include "C:\scriptbasic\include\odbc.bas" dbh = odbc::RealConnect("DSN","user","password") odbc::query(dbh,"SELECT * FROM bible WHERE word_name LIKE 'am%'") WHILE odbc::FetchHash(dbh,column) PRINT LEFT(column{"word_name"} & STRING(30," "),30),column{"word_count"},"\n" WEND odbc::Close(dbh)
--- Code: Text ---C:\scriptbasic\test>odbctestam 164ama 1amabit 1amad 1amalek 15amalekites 9amam 1amazed 1ambassadors 2ambrose 2ambrosianum 1ambush 7amen 15amend 1amending 1amends 1amerce 1amethyst 2ammiel 1ammihud 7amminadab 6ammishaddai 5ammon 38ammonite 1ammonites 1among 281amongst 2amorite 9amorites 62amos 1amram 6amram's 1amramites 1amraphel 2
The ODBC example is using the MySQL ODBC Connector driver. Both examples are accessing the same MySQL database table and produce the same results.
Navigation
[0] Message Index
Go to full version