I'm using C++ Builder and having trouble adding query inside MS Access (2003) database. I use this code:
CatalogPtr cat = CoCatalog::Create();
VARIANT myConnectionString;
myConnectionString.vt = VT_BSTR;
myConnectionString.bstrVal = ADOConnetion1->ConnectionString.c_bstr();
cat->set_ActiveConnection(myConnectionString);
VARIANT mySQL;
mySQL.vt = VT_BSTR;
mySQL.bstrVal = L"Select * from table1";
cat->Views->Append(L"TestQuery", mySQL.pdispVal);
Compiling is OK, but when running this code I get access violation... What am I doing wrong here?