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
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Accessing CRecordSet through dialog class

Accessing CRecordSet through dialog class

Scheduled Pinned Locked Moved C / C++ / MFC
c++databasedebugginghelpquestion
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • H Offline
    H Offline
    heavenode
    wrote on last edited by
    #1

    i want to create a login dialog box with username and password details stored in MS Access file. i created a new CRecordSet class : class CPasswordSet : public CRecordset { public: CPasswordSet(CDatabase* pDatabase = NULL); DECLARE_DYNAMIC(CPasswordSet) // Field/Param Data //{{AFX_FIELD(CPasswordSet, CRecordset) long m_ID; CString m_Username; CString m_Password; //}}AFX_FIELD // Overrides // ClassWizard generated virtual function overrides //{{AFX_VIRTUAL(CPasswordSet) public: virtual CString GetDefaultConnect(); // Default connection string virtual CString GetDefaultSQL(); // Default SQL for Recordset virtual void DoFieldExchange(CFieldExchange* pFX); // RFX support //}}AFX_VIRTUAL // Implementation #ifdef _DEBUG virtual void AssertValid() const; virtual void Dump(CDumpContext& dc) const; #endif }; and a CDialog class as below with a CPasswordSet public variable m_passwordSet: void CLoginDlg::OnBlogin() { CString str; str = m_passwordSet.m_Username; MessageBox (str); //i get nothing, empty string m_passwordSet.Edit() //get error with this line //debug assertion dbcore.cpp line 1620 } may i know what's wrong??

    J 1 Reply Last reply
    0
    • H heavenode

      i want to create a login dialog box with username and password details stored in MS Access file. i created a new CRecordSet class : class CPasswordSet : public CRecordset { public: CPasswordSet(CDatabase* pDatabase = NULL); DECLARE_DYNAMIC(CPasswordSet) // Field/Param Data //{{AFX_FIELD(CPasswordSet, CRecordset) long m_ID; CString m_Username; CString m_Password; //}}AFX_FIELD // Overrides // ClassWizard generated virtual function overrides //{{AFX_VIRTUAL(CPasswordSet) public: virtual CString GetDefaultConnect(); // Default connection string virtual CString GetDefaultSQL(); // Default SQL for Recordset virtual void DoFieldExchange(CFieldExchange* pFX); // RFX support //}}AFX_VIRTUAL // Implementation #ifdef _DEBUG virtual void AssertValid() const; virtual void Dump(CDumpContext& dc) const; #endif }; and a CDialog class as below with a CPasswordSet public variable m_passwordSet: void CLoginDlg::OnBlogin() { CString str; str = m_passwordSet.m_Username; MessageBox (str); //i get nothing, empty string m_passwordSet.Edit() //get error with this line //debug assertion dbcore.cpp line 1620 } may i know what's wrong??

      J Offline
      J Offline
      Jose Lamas Rios
      wrote on last edited by
      #2

      heavenode wrote: m_passwordSet.Edit() //get error with this line //debug assertion dbcore.cpp line 1620 [...] may i know what's wrong?? What exactly do you want to do at CLoginDlg::OnBlogin()? Do you want to retrieve a user/password from the database, edit an existing one, or add a new pair? The call to Edit doesn't seem to make sense unless you already have a current record. -- jlr http://jlamas.blogspot.com/[^]

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

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