0

我正在使用 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);

编译没问题,但是在运行此代码时,我遇到访问冲突......我在这里做错了什么?

4

0 回答 0