m_pRecordset.CreateInstance("ADODB.Recordset");
if(SUCCEEDED(hm))
{
m_pRecordset->Open("SELECT *FROM filmrecord",_variant_t((IDispatch*)m_pConnection,true),adOpenStatic,adLockOptimistic,adCmdText);
}
突然之间打不开记录集?
不知道怎回事,请各位高人指点
if(SUCCEEDED(hm))
{
m_pRecordset->Open("SELECT *FROM filmrecord",_variant_t((IDispatch*)m_pConnection,true),adOpenStatic,adLockOptimistic,adCmdText);
}
突然之间打不开记录集?
不知道怎回事,请各位高人指点
{
if(m_strDatabase.IsEmpty())
{
::MessageBox(NULL,"Êý¾Ý¿â²»ÄÜΪ¿Õ£¡","Ìáʾ",MB_OK);
return false;
}
theApp.m_pConnection.CreateInstance(__uuidof(Connection));
try
{
theApp.m_strDatabase=m_strDatabase;
m_strDatabase.Replace("\\","\\\\");
_bstr_t strConn;
if(m_strPassword.IsEmpty())
{
strConn="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" +m_strDatabase;
theApp.m_pConnection->CursorLocation = adUseClient;
theApp.m_pConnection->Open(strConn,
"",
"",
adModeUnknown);
}
else
{
strConn="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" +m_strDatabase+";Persist Security Info=False;Jet OLEDB:DataBase Password="+m_strPassword;
theApp.m_pConnection->Open(strConn,
"",
"",
adModeUnknown);
}
}
catch(_com_error e)
{
::MessageBox(NULL,e.Description(),"Ìáʾ", MB_OK);
return FALSE;
}
::MessageBox(NULL,"Êý¾Ý¿âÁ¬½Ó³É¹¦£¡","Ìáʾ", MB_OK);
return TRUE;
}