ADOX - 如何在MS Access数据库中添加Query?

时间:2013-08-05 23:13:32

标签: c++ database ado c++builder adox

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

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

0 个答案:

没有答案