I'm currently trying to rework an older project. It uses the Dao interface to connect to a MS-Access database. It now needs to connect to a SQL CE Database using the ADO driver.
However, I keep getting the IDispatch error, see below.
CJapRecordsets is a class with membervariables that inherits from _RecordsetPtr.
I'm not sure if it should inherit _RecordsetPtr or CADORecordset.
I did try to change it to CADORecordset(this seems to be working out better - there are functions that do not exist in _RecordsetPtr even though I need them). However I get an IDispatch Error #3105 here...
1 2 3 4 5 6 7 8 9 10 11 12 13 14
rs = new CJapRecordsets(Global::MyDatabase);
if(!Global::MyDatabase->IsOpen())
{
Global::MyDatabase->Open("Provider=Microsoft.SQLSERVER.CE.OLEDB.3.5;Data Source=C:\JAP-MAIN.sdf;");
}
if(!rs->IsOpen())
{
// This causes the IDispatch error
rs->Open(Global::MyDatabase->GetActiveConnection().GetInterfacePtr(),"SELECT * FROM Gesamt", 1);
}
I can open the database successfully and check if the recordset is open or closed. However, upon trying to execute a select query, I keep getting an IDispatch error.