|
1鱼币
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();
}
|
|