我正在使用C ++ Builder,但在MS Access(2003)数据库中添加查询时遇到问题。我使用这段代码:
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);
编译没问题,但是在运行此代码时我遇到了访问冲突......我在这里做错了什么?