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. how could i keep the value of a specific pointer?

how could i keep the value of a specific pointer?

Scheduled Pinned Locked Moved C / C++ / MFC
questionc++databasedata-structurestutorial
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.
  • G Offline
    G Offline
    Gerald Mercet
    wrote on last edited by
    #1

    In my dialog app i have 2 functions which use ADO connection to catch value from a database, and which put them into a "C" pointer of pointer and a regular pointer. I want after in a third function use the 2 pointers, which represent some of the input data. As i do it with 3 different button which each of them call one and only one function. For example the first, called OnLoadCorrel, put a whole matrix into a **pCorrel, the second one called On LoadVol, put a whole array into a *pVol. And, finally, the 3 function use the values needed coming from the matrix and the array. It's at this point of my app that there's a pb, because when i call the third function, the app doesn't recognize (or know) the value into both the pointers (perhaps the value have been lost?!?) So you could see the following lost, and i hope that soeone could find if what is wron in my app. ///////////////////////////////////////////////////////// So, in the CalcRiskPortDlg.cpp:: void CCalcRiskPortDlg::OnLoadVol() { UpdateData(TRUE); ::CoInitialize(NULL); LoadTables Table(m_dlgSector); int i; // _variant_t IndexCol; CString strValue; try { _ConnectionPtr pConnection=NULL; CString strTemp; strTemp.Format("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\\CalcRiskPort\\vol_correl1.mdb;"); _bstr_t strCnn(strTemp); TESTHR(pConnection.CreateInstance(__uuidof(Connection))); pConnection->Open(strCnn,"","",adConnectUnspecified); _RecordsetPtr pTp("ADODB.Recordset"); try { pTp->Open("Volatilité",strCnn,adOpenStatic,adLockOptimistic,adCmdTableDirect); if(!pTp->EndOfFile) { for(i=1;i<=m_dlgSector;i++) { pTp->MoveFirst(); pTp->Move(i-1); //strIndexCol=Table.ConvIntToVar((double)j); //strIndexCol=strIndexCol+strT; //_variant_t IndexCol(strIndexCol); *(Table.pVol+i)=pTp->Fields->GetItem("Volatilité")->Value; } } //dValue=pTp->Fields->GetItem("N° Titre")->Value; //Parameter2=pTp->Fields->GetItem(IndexColumn)->Value; pTp->Close(); } catch(_com_error &e) { AfxMessageBox("a pas bon"); } m_dlgValue=Table.pVol[3]; strValue.Format("%.9f",m_dlgValue); CEdit* PEdit=(CEdit*)GetDlgItem(IDC_VALUE); PEdit->SetWindowText(strValue); //Table.free_dmatrix(Table.pCorrel,1,m_dlgPortWeight,1,m_dlgPortWeight); pConnection->Close(); } catch(_com_error &e) { AfxMessageBox("a pas bon"); } ::CoUninitialize(); // TODO: Add your control notification handler code he

    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