12.07.2015 Views

ILOG OPL Development Studio Language Reference Manual

ILOG OPL Development Studio Language Reference Manual

ILOG OPL Development Studio Language Reference Manual

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

The oildatabase exampleThe syntax for databases is valid only for data files, with the extension .dat, not for modelfiles with the extension .mod. This section uses the oilDB example to demonstrate operationswith a Microsoft Access database. You can find this example in/examples/opl/oilwhere is your installation directory.Working with databases (oilDB.dat)DBConnection db("access","oilDB.mdb");Gasolines from DBRead(db,"SELECT name FROM GasData");Oils from DBRead(db,"SELECT name FROM OilData");GasData from DBRead(db,"SELECT * FROM GasData");OilData from DBRead(db,"SELECT * FROM OilData");MaxProduction = 14000;ProdCost = 4;DBExecute(db,"drop table Result");DBExecute(db,"create table Result(oil varchar(10), gas varchar(10), blend real,a real)");Result to DBUpdate(db,"INSERT INTO Result(oil,gas,blend,a) VALUES(?,?,?,?)");56I L O G O P L D E V E L O P M E N T S T U D I O L A N G U A G ER E F E R E N C E M A N U A L

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!