Re: Need sample to read from db
For some security reasons,
I preffer ADO solution,
with no need to install other 3rd party programs.
(I have checked some drivers,
and there seems to be problems on some versions of oracle,
and drivers which are not Oracle,
and I cannot risk the system for that).
Thanks :)
"Eric Hill" <eric@ijack.net> wrote in message
news:op.thzzfex3sqk0wa@wcerich-6223.pioneer.world...
I need a sample code in order to read/write from oracle database 9i,
by using the ADO engine.
(Visual Studio 6.0 - Visual C++).
I know you said ADO, but OTL is *far* better than ADO when working with
Oracle databases:
http://otl.sourceforge.net
1) connect to db
otl_connect db("scott/tiger@oracle.host");
2) make sql query (with / without parameters).
otl_stream q1(128, "select dummy from dual", db);
otl_stream q2(128, "select dummy from dual where dummy = :d<char[1]>", db);
3) run the sql query
char dummy_param[1];
dummy_param[0] = 'X';
q2 << dummy_param;
// q1 and q2 are executed automatically
4) fetch the results
while (!q1.eof()) {
std::string dummy_value;
q1 >> dummy_value;
std::cout << dummy_value; // Whatever
}
5) close query
// Automatically done when out of scope
6) run update query.
otl_stream q3(256, "update ... set ... = :param<type>, etc...", db);
7) close connection.
db.logoff();