一个对话框中有edit控件 变量为m_a;access中有一个表password;仅有一个项,仅有一个直passworda; 在edit中输入一个数同password比较相同,继续调用下一个对话框,
否则退出

解决方案 »

  1.   

    DoModual a dialog box, then copmare the password if right continue, else send quit message to quit the application.If you want to copmare the password when the application is being initialized, place you code in the OnNewDocument() function in class CMyDoc .
      

  2.   


    1. 你在第一个对话框的ONOK()中做比较,不同则return;2. 调用是       CYourDlg dlg;
           if(DoModal()!=IDOK)
              return;
           ...
    3. 试吧
      

  3.   

    先打开数据库,取得password的值.#include "afxdb.h",定义变量CDaoDatabase m_pNewDatabase和CDaoRecordset m_pNewRecordset;
    m_pNewDatabase = new CDaoDatabase;
    try
    {
    m_pNewDatabase->Open(m_strFilePath);
    m_pNewRecordset = new CDaoRecordset(m_pNewDatabase);
    }
    catch(CDaoException* e)
    {
    e->ReportError();
    delete m_pNewDatabase;
    m_pNewDatabase = NULL;
    e->Delete();
    return;
    }
             CString strSql;
    strSql.Format("SELECT FieldName FROM YourTableName");
             m_pNewRecordset->Open(dbOpenDynaset,strSql);
             
             COleVariant varValue;
    short sIndex = 0;
    m_pNewRecordset->GetFieldValue(sIndex,varValue);
    if(m_a== varValue.bstrVal)
             ............
             m_pNewRecordset->Close();