Link to home
Start Free TrialLog in
Avatar of mparam
mparam

asked on

C++ and ADODB- Retreiving all the fields of a row with Recordset

hi all,
I have to make an application which would talk to two databases : Sybase and Oracle and check whether all the fields in all the tables in both the databases are in sync.
The issue is I am unable to retreive all the columns with the recordset. I found many examples and code snippets on the net which retrieves specific column  of each row using bstr = recordset->field->item->value. this is not feasible since the tables differ in their number of columns and some of them have upto 20 columns.
Is there a way I can get all the coulmns of each row print it on the output.
I would later write a parser which would compare the output from the tables across sybase and oracle.
ASKER CERTIFIED SOLUTION
Avatar of clockwatcher
clockwatcher

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of mparam
mparam

ASKER

thanks for providing a soln. i will try it and revert.
Avatar of mparam

ASKER

On trying to compile the code I get the following errors at line 2. could you please help?
C:\my program\dld\seccompas\database.cpp(102) : error C2065: 'adOpenStatic' : undeclared identifier
C:\my program\dld\seccompas\database.cpp(102) : error C2065: 'adLockOptimistic' : undeclared identifier
C:\my program\dld\seccompas\database.cpp(102) : error C2065: 'adCmdTable' : undeclared identifier
C:\my program\dld\seccompas\database.cpp(103) : error C2065: 'adCmdText' : undeclared identifier
line1             dbrs.CreateInstance("ADODB.Recordset");
line2             dbrs->Open (table_name, _variant_t((IDispatch *) dbcn,true), adOpenStatic, adLockOptimistic, adCmdTable);
To use those constants, you'll need to specify the namespace :

  ADODB::adOpenStatic

Or specify no namespace on your import:

  #import "C:\Program Files\Common Files\System\ado\msado15.dll" rename("EOF","adoEOF") no_namespace
 

Forced accept.

Computer101
EE Admin