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. A problem updating FoxPro table.

A problem updating FoxPro table.

Scheduled Pinned Locked Moved C / C++ / MFC
helpc++databasedebuggingquestion
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.
  • I Offline
    I Offline
    iluha
    wrote on last edited by
    #1

    Hello everyone. I'm new to C++ and I can't get this to work. Please let me know if I'm doing something wrong besides my problem :) I can not update two fields in FoxPro database it gives me an error "Can't update. Database or object is read-only" This is how it goes: CDaoDatabase* pDatabase = new CDaoDatabase; pDatabase->Open("C:\\Work\\UpdateDBF\\INPUT", //path only! TRUE, //exclusive? FALSE, //read only? "FoxPro 3.0;"); //connect string CDaoRecordset rsCUST(pDatabase); rsCUST.Open(dbOpenDynaset, "SELECT Custnum, noemail, norent FROM [CUST.dbf]"); rsCUST.MoveFirst(); //move to the beginning so we start from the begin rsCUST.FindFirst( "Custnum = " + strCustNum );// strCustNum is a number i pull from a text file if (rsCUST.IsEOF != 0){//if found the record oleTemp.ChangeType( VT_BOOL ); oleTemp.boolVal = true; try { // this is where it fails // the error i get is "Can't update. Database or object is read-only" rsCUST.SetFieldValue("noemail", oleTemp); rsCUST.SetFieldValue("norent", oleTemp); } catch(CDaoException* e){ TCHAR szCause[255]; CString strFormatted = _T("The data file could not be updated because of this error: \n"); e->GetErrorMessage(szCause, 255); strFormatted += szCause; AfxMessageBox(strFormatted, MB_OK | MB_ICONEXCLAMATION); } catch (...) { TRACE ( "*** Unhandled Exception ***" ); } } //if (rsCUST.IsEOF != 0){ If any one know please let me know Thank you in advance. ilya iluha

    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