在线等!!!!!!!! ADO+SQL Server
_ConnectionPtr mcConnection;
_RecordsetPtr mcRecordset;
bool mbConnected;
HRESULT hr;
_bstr_t source("Driver={SQL Server};Server=CHOCOBO;Uid=PIV;Pwd=PIV;Database=PIZZA.NET");
_bstr_t user("sa");
_bstr_t pwd("");
try
{
hr = mcConnection.CreateInstance(_uuidof(Connection));
hr = mcConnection->Open(source, user, pwd, 16);
hr = mcRecordset.CreateInstance(_uuidof(Recordset));
mbConnected = true;
hr = mcConnection->Close();
}
以上程序在执行时总在最后Close时出错,出错信息用ERROR捕捉为:“对象关闭时,不允许操作”,不知是什么原因。