Hello,
I have several reports that were written with ADO shape command (in
C++) to access Microsoft Access database. Now we have migrated all the
data from Access to DB2 UDB (version 8.1), and the shape command does
not work any more. I have changed the provider and connection string
from:
pConn->Provider = "MSDataShape";
SAFE_CALL( pConn->Open( "DBQ=myAccessDB.mdb; DefaultDir=.;
Driver={Microsoft Access Driver (*.mdb)};", "sa", "", 0 ) );
to:
pConn->Provider = "IBMDADB2";
SAFE_CALL( pConn->Open( "dsn=myDB", "myUserName", "myPwd",
adModeUnknown ) );
The following is a snippet of the shape command I have:
bstrQuery = "SHAPE {SELECT PicIndex, PicID, InspectionNumber FROM
MaskIdInfo WHERE PicIndex =";
bstrQuery += bstrPicIndex;
bstrQuery += "} APPEND ";
bstrQuery += " ({SELECT PicIndex, Date, Time FROM
PicLoadOccasion ";
bstrQuery += "ORDER BY LoadOccasionIndex DESC";
bstrQuery += "} RELATE PicIndex TO PicIndex) AS rsLoadOccasion, ";
bstrQuery += " ({SELECT PicIndex, DefectIndex FROM PicDefect ";
bstrQuery += "ORDER BY DefectIndex ";
bstrQuery += _bstr_t(sortOrder);
bstrQuery += "} RELATE PicIndex TO PicIndex) AS rsPicDefect, ";
bstrQuery += " ({SELECT PicIndex, Date, Time FROM PicRepairHist
";
bstrQuery += "ORDER BY PicRepairHistId DESC";
bstrQuery += "} RELATE PicIndex TO PicIndex) AS rsPicRepairHist";
I tried to change the provider to "MSDataShape" (as it was before the
migration to DB2), it does not work of course. How should I specify
the provider and the connection string so the shape command works with
DB2? Or does shape command work with DB2 at all?
Thanks for any help.