Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
L

LoveInSnowing

@LoveInSnowing
About
Posts
10
Topics
3
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • What's wrong with my code?
    L LoveInSnowing

    Thank you,under the help of others,I had solved the problem. Thanks again. A beginner of Visual C++,and need your help.

    C / C++ / MFC database graphics question

  • What's wrong with my code??
    L LoveInSnowing

    Thanks,you're right. When I open the "Open/Save File Dialog",it changed the current directory. It cannot find the database,so the wrong message appeared. Thanks again.:)

    C / C++ / MFC database graphics question

  • What's wrong with my code??
    L LoveInSnowing

    No,I means when I click the "Try" button again,the wrong message appeared,while when I first clicked the "Try" button,everything is OK. I tried to change my code with an other way such as: CFirstDialog::OnButtonTry() { CTestDialog dlg; dlg.DoModal(); } It's still wrong. Because I use Chinese,so the error message was showed in Chinese,I only know the error number is 0x80004005,what it means?

    C / C++ / MFC database graphics question

  • What's wrong with my code??
    L LoveInSnowing

    Because I am a beginner of VC++ from China,and the error message was showed in Chinese,I only know the error number is 0x80004005,I don't know what is means?Please Help me.

    C / C++ / MFC database graphics question

  • What's wrong with my code??
    L LoveInSnowing

    I had written a dialog based application. It contained a button named "Try" When I clicked the "Try" button,opened an other dialog named "Test" which contained a button named "Open". When I first clicked "Open" button and clicked the "OK" button in Open File Dialog,everything is ok,and then close the "Test" Dialog. But When I click "Try" button again,it showed me wrong. Who can please tell me what's wrong with my code?? ****************************************************************** void CFirstDlg::OnButtonTry() { // TODO: Add your control notification handler code here CTestDialog* dlg; dlg=new CTestDialog; dlg->DoModal(); } ****************************************************************** BOOL CTestDialog::OnInitDialog() { CDialog::OnInitDialog(); // TODO: Add extra initialization here CString sCon; _ConnectionPtr m_pCon; _RecordsetPtr m_pRs; sCon="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=main.mdb"; CoInitialize (NULL); HRESULT hr=S_OK; try { hr=m_pCon.CreateInstance(__uuidof(Connection)); if(FAILED(m_pCon->Open(_bstr_t(sCon),"","",adModeUnknown))) AfxMessageBox("Can not open the database!"); } catch(_com_error e) { CString errormessage; errormessage.Format("Failed!\r\nError Message:%s",e.ErrorMessage()); AfxMessageBox(errormessage); } m_pRs.CreateInstance("ADODB.Recordset"); if(FAILED(m_pRs->Open("SELECT * FROM employeer",_variant_t((IDispatch*)m_pCon,true),adOpenStatic,adLockOptimistic,adCmdText))) AfxMessageBox("Can not open the record set!"); if((m_pRs->State & adStateOpen) == adStateOpen) m_pRs->Close(); if ( (m_pCon->State & adStateOpen) == adStateOpen) m_pCon->Close(); CoUninitialize(); return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE } *********************************************************************** void CTestDialog::OnButtonOpen() { // TODO: Add your control notification handler code here static char BASED_CODE szFilter[]="Bitmap Files (*.bmp)|*.bmp||"; CFileDialog *fd; fd=new CFileDialog(TRUE,NULL,NULL,OFN_HIDEREADONLY,szFilter,this); if(IDOK!=fd->DoModal()) return; else AfxMessageBox(fd->GetFileName()); delete fd; }

    C / C++ / MFC database graphics question

  • What's wrong with my code?
    L LoveInSnowing

    The wrong still happened,what should I do?

    C / C++ / MFC database graphics question

  • What's wrong with my code?
    L LoveInSnowing

    The wrong still happened.

    C / C++ / MFC database graphics question

  • What's wrong with my code?
    L LoveInSnowing

    I had written a dialog based application. It contained a button named "Try" When I clicked the "Try" button,opened an other dialog named "Test" which contained a button named "Open". When I first clicked "Open" button and clicked the "OK" button in Open File Dialog,everything is ok,and then close the "Test" Dialog. But When I click "Try" button again,it showed me wrong. Who can please tell me what's wrong with my code?? ****************************************************************** void CFirstDlg::OnButtonTry() { // TODO: Add your control notification handler code here CTestDialog* dlg; dlg=new CTestDialog; dlg->DoModal(); } ****************************************************************** BOOL CTestDialog::OnInitDialog() { CDialog::OnInitDialog(); // TODO: Add extra initialization here CString sCon; _ConnectionPtr m_pCon; _RecordsetPtr m_pRs; sCon="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=main.mdb"; CoInitialize (NULL); HRESULT hr=S_OK; try { hr=m_pCon.CreateInstance(__uuidof(Connection)); if(FAILED(m_pCon->Open(_bstr_t(sCon),"","",adModeUnknown))) AfxMessageBox("Can not open the database!"); } catch(_com_error e) { CString errormessage; errormessage.Format("Failed!\r\nError Message:%s",e.ErrorMessage()); AfxMessageBox(errormessage); } m_pRs.CreateInstance("ADODB.Recordset"); if(FAILED(m_pRs->Open("SELECT * FROM employeer",_variant_t((IDispatch*)m_pCon,true),adOpenStatic,adLockOptimistic,adCmdText))) AfxMessageBox("Can not open the record set!"); if((m_pRs->State & adStateOpen) == adStateOpen) m_pRs->Close(); if ( (m_pCon->State & adStateOpen) == adStateOpen) m_pCon->Close(); CoUninitialize(); return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE } *********************************************************************** void CTestDialog::OnButtonOpen() { // TODO: Add your control notification handler code here static char BASED_CODE szFilter[]="Bitmap Files (*.bmp)|*.bmp||"; CFileDialog *fd; fd=new CFileDialog(TRUE,NULL,NULL,OFN_HIDEREADONLY,szFilter,this); if(IDOK!=fd->DoModal()) return; else AfxMessageBox(fd->GetFileName()); delete fd; }

    C / C++ / MFC database graphics question

  • Please give me help.
    L LoveInSnowing

    When should I show this message when I switch the view?

    C / C++ / MFC database help question

  • Please give me help.
    L LoveInSnowing

    I write a program which used database and use Multi View in splitter window, when I switch the view,I must check if the database is empty first.If so, how can I show a message,such as the database is empty ..

    C / C++ / MFC database help question
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups