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. ATL / WTL / STL
  4. Question about inserting into dbf file

Question about inserting into dbf file

Scheduled Pinned Locked Moved ATL / WTL / STL
databasequestioncomhelp
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.
  • M Offline
    M Offline
    monsieur_jj
    wrote on last edited by
    #1

    I have this code below that updates a dbf file now this code before also updates a cdx file but I changed something in the values I added now the cdx file is not inline with the dbf. I have tried to "reindex" and "SET INDEX TO" however everytime I do an insert in the dbf table the modified date of the cdx file stays the same as the old one. Should the cdx be updated everytime there is something new inserted?

    DIAGNOSTICS_CHECKPOINT;
    LOG(L"AutoLoad File Connection String");
    LOG(this->_connectionstring.c_str());
    cnn->CursorLocation = adUseClient;
    try { hr = cnn->Open(this->_connectionstring.c_str(), L"", L"", 0); }
    catch (_com_error& e)
    { wss.str(L"");
    wss << L"Opening the AutoloadFile connection from '"
    << _connectionstring.c_str()
    << L"' has failed (COM Error: " << e.ErrorMessage()
    << L", " << hr << L")."
    << std::endl;
    LOG(wss.str().c_str());
    throw;
    }

    DIAGNOSTICS\_CHECKPOINT;
    wss.str(L"");
    wss << L"INSERT INTO " 
    	<< this->\_tablename
    	<< L" VALUES ('" 
    	<< trans\_id << L"','" 
    	<< params << L"','"
    	<< status << L"',"
    	<< rec\_no << L")"
    	;
    
    DIAGNOSTICS\_CHECKPOINT;
    std::wstring sql(wss.str().c\_str());
    LOG(L"Executing INSERT into the autoload file");
    LOG(sql.c\_str());
    try 
    {	rs->Open(sql.c\_str(), cnn.GetInterfacePtr(), 
    		adOpenForwardOnly, adLockReadOnly, adCmdText);
    }
    catch (\_com\_error& e)
    {	wss.str(L"");
    	wss << L"Executing SQL statement:\\n" 
    		<< sql.c\_str() 
    		<< L"'\\n...has failed (COM Error: " 
    		<< e.Error() << L", '"
    		<< e.ErrorMessage()
    		<< L"')." 
    		<< std::endl;
    	LOG(wss.str().c\_str());
    	throw;
    }
    
    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