我想用ADO连接Access 数据库, 完成查询功能,并将结果返回到另一个对话框PersonInfDialog里,消息SearchS实现这个功能,可在Open数据集是出现Runtime Error
void CPersonDialog::OnSearch() 
{
    // TODO: Add your control notification handler code here
    UpdateData(true);
    CString strSQL;
    _RecordsetPtr m_pRecordset;
    HRESULT hTRes;
    hTRes = m_pRecordset.CreateInstance(_T("ADODB.Recordset"));    

    strSQL="select * from 机票信息";
    CString str;
    str.Format("%d-%d-%d",m_time.GetYear(),m_time.GetMonth(),m_time.GetDay());
    strSQL+=" where riqi='"+str+"' ";

    
    if(m_start!="")
    {
        strSQL+=" and chufachengshi='"+m_start+"' ";
    }
    if(m_end!="")
    {
        strSQL+=" and mudichengshi='"+m_end+"' ";
    }
    
    
//    AfxMessageBox(strSQL);
    
    hTRes = m_pRecordset->Open((LPTSTR)strSQL.GetBuffer(130),
            ((CMyApp*)AfxGetApp())->m_pConn.GetInterfacePtr(),
            adOpenDynamic,adLockPessimistic,adCmdText);
}
我以将我的这个程序上传,由于太大了,我把debug和res文件夹删了,要是需要完整的,你告诉我,我用邮箱发给你,希望高手帮帮小弟,刚学数据库,不太会,如果你帮我该过来了,那就太谢谢了,请发到我的QQ邮箱,406589639@qq.com,我都调了快一周了,都要疯了