C域 发表于 2014-7-2 17:30:08

cv++ MFC ADO 幫我看看為為什麽報錯

void CAdo2Dlg::OnButton2() //秙2
{
CoInitialize(NULL);
_ConnectionPtr pConn(__uuidof(Connection));
_RecordsetPtr pRst(__uuidof(Recordset));
_CommandPtr pCmd(__uuidof(Command));
pConn->ConnectionString="Provider=MSDAORA.1;Password=PES20124;User ID=MCP;Data Source=TPES;Persist Security Info=True";//連接字串OK
pConn->Open("","","",adConnectUnspecified);
pCmd->put_ActiveConnection(_variant_t((IDispatch*)pConn));
pCmd->CommandText="UPDATE DQC07 SET STATION ='LG01H' WHERE STATION ='VMI1'";

pRst=pCmd->Execute(NULL,NULL,adCmdText);

///////////////////////關閉
pRst->Close();
pConn->Close();
pCmd.Release();
pRst.Release();
pConn.Release();
CoUninitialize();
}

页: [1]
查看完整版本: cv++ MFC ADO 幫我看看為為什麽報錯