meta data for this page
ODBC Examples
- Download IBEBlockScriptSamples.zip from https://www.ibexpert.com/download/other_files/
- Copy Demo.mdb and ODBCAcc.ibeblock (found in the Blocks/ODBC Access directory) into a separate directory
- Copy ODBCAcc.ibeblock (copy of script below) into the SQL Editor.
- You can find the correct connection string for the ODBC driver you are using here: Connection Strings
- Modify the path to Demo.mdb.
- Press [F9] to execute the block.
execute ibeblock returns (CustNo integer, Company varchar(100), Addr1 varchar(100)) as begin InCust = 3000; OdbcCon = ibec_CreateConnection(__ctODBC, 'DBQ=D:\Delphi5\CMP\mODBC\DB\demo.mdb;DRIVER=Microsoft Access Driver (*.mdb)'); ibec_UseConnection(OdbcCon); execute statement 'select Company from customer where CustNo = 4312' into :MyCust; for select CustNo, Company, Addr1 from customer where CustNo > :InCust order by company into :CustNo, :Company, :Addr1 do begin suspend; end ibec_CloseConnection(OdbcCon); end
Connection Strings offers a huge range of ODBC drivers for all possible databases:
along with the connection strings. For example, if you want to access Excel data:
Please also refer to IBExpert's ODBC Viewer.