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. Database & SysAdmin
  3. Database
  4. Recordset AddNew fails

Recordset AddNew fails

Scheduled Pinned Locked Moved Database
c++databasehelpannouncement
1 Posts 1 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.
  • R Offline
    R Offline
    RadioOpa
    wrote on last edited by
    #1

    I derived a Class "CProtocol" from CRecordset which is linked with but one database table. Everything works fine until I call AddNew(), here I receive a assertion Faile Message, referring to dbcore.cpp Code sniplet ( .cpp file): CString csTimeNow; // Hole Hostnamen DWORD dwHostLength = MAX_COMPUTERNAME_LENGTH + 1; GetComputerName( csComputerName.GetBuffer( 0), &dwHostLength); // Hole UserNamen DWORD dwUserLength = UNLEN + 1; GetUserName( csUserName.GetBuffer( 0), &dwUserLength); // Hole aktuelle Zeit COleDateTime coTimeNow(COleDateTime::GetCurrentTime()); csTimeNow.Format( "%04d%02d%02d%02d%02d%02d00", coTimeNow.GetYear(), coTimeNow.GetMonth(), coTimeNow.GetDay(), coTimeNow.GetHour(), coTimeNow.GetMinute(), coTimeNow.GetSecond()); // Instanz zur Datenbank aufbauen CString csConnectionString; csConnectionString = "DSN=ODR_CRM;UID=ODRGMBH;PWD=origin"; m_pDB = new CDatabase(); if( m_pDB->OpenEx(csConnectionString,CDatabase::noOdbcDialog)) { // We´re connected to the database } else { // we have a problem connecting to the database } // Access to Class Protokoll Table m_pProtocol = new CProtokoll( m_pDB); m_pProtocol->Open(); // ready to use m_pProtocol->m_Timestamp = csTimeNow; m_pProtocol->m_Benutzer = csUserName; m_pProtocol->m_Rechner = csComputerName; m_pProtocol->m_Aktion = csMessage; if( m_pProtocol->IsOpen() ) { m_pProtocol->AddNew(); // Ready to add new records } m_pProtocol->Update(); // Update Table m_pProtocol->Requery(); // .h file CDatabase* m_pDB; // Pointer to CDatabase Class CProtokoll* m_pProtocol; // Pointer to CRecordset Class

    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