15 мая 2023 года "Исходники.РУ" отмечают своё 23-летие!
Поздравляем всех причастных и неравнодушных с этим событием!
И огромное спасибо всем, кто был и остаётся с нами все эти годы!

Главная Форум Журнал Wiki DRKB Discuz!ML Помощь проекту


Reading and Writing Binary Large Objects (BLOBS) to ACCESS

David W -- David.W.Archer@JCI.Com
Friday, March 28, 1997








     Environment: VC++ 4.1, Win95


     I am having problems reading and writing binary data to/from an access
     database table. I have set up an Ole Object Field in access, which per
     the access doc is the correct data type for binary data.

     In my code I have created a CDaoRecordset derived class for handling
     reading and writing the binary data.  Class Wizard binds a CLongBinary
     to the Ole Object field when creating the recordset. I am using this
     CLongBinary to attempt read/write but it does not seem to be working.
     Here is a sample of the code I am using to write binary data to the
     recordset. m_pGraphAttr->m_GraphAttr is the database field under
     question.

     m_pGraphAttr->Edit();

     //PEstorepartial places the hGlobal of the binary data memory
     //location in m_pGraphAttr->m_GraphAttr.m_hData
     if(!PEstorepartial(m_hPE,&m_pGraphAttr->m_GraphAttr.m_hData,&dwSize))
        {
             ASSERT( FALSE );
        }

     m_pGraphAttr->Update();

     I thought this would be adequate for updating the database field, but
     it does not seem to work?

     David Archer
     david.w.archer@jci.com
     Johnson Controls Inc.






John Bundgaard -- piano_boxer@post1.com
Sunday, March 30, 1997

In the recordset, that is to receive the binary data, bind a CByteArray
variable to the field.
When storing, call 
   
|  m_pSet->m_oByteArray.SetSize(m_nMyDataSize);
|  if(memcmp(&m_pSet->m_oByteArray[0], m_pMyData, m_nMyDataSize))
|  {
|      memcpy(&m_pSet->m_oByteArray[0], m_pMyData, m_nMyDataSize)
|      m_pSet->SetFieldNull(FALSE);
|      m_pSet->SetFieldDirty(TRUE);
|  }
|
|  //........

 ----
From: Archer, David W 
To: mfc-l@netcom.com
Date: 30. marts 1997 14:23
Subject: Reading and Writing Binary Large Objects (BLOBS) to ACCESS








     Environment: VC++ 4.1, Win95


     I am having problems reading and writing binary data to/from an
access
     database table. I have set up an Ole Object Field in access, which
per
     the access doc is the correct data type for binary data.

     In my code I have created a CDaoRecordset derived class for handling
     reading and writing the binary data.  Class Wizard binds a
CLongBinary
     to the Ole Object field when creating the recordset. I am using this
     CLongBinary to attempt read/write but it does not seem to be working.
     Here is a sample of the code I am using to write binary data to the
     recordset. m_pGraphAttr->m_GraphAttr is the database field under
     question.

     m_pGraphAttr->Edit();

     //PEstorepartial places the hGlobal of the binary data memory
     //location in m_pGraphAttr->m_GraphAttr.m_hData
     if(!PEstorepartial(m_hPE,&m_pGraphAttr->m_GraphAttr.m_hData,&dwSize))
        {
             ASSERT( FALSE );
        }

     m_pGraphAttr->Update();

     I thought this would be adequate for updating the database field, but
     it does not seem to work?

     David Archer
     david.w.archer@jci.com
     Johnson Controls Inc.




==========================================================================
PostOne tip: Make new contacts, get to know other PostOne users.
Check it out at http://www.post1.com/cgi-bin/member/pshowplan
==========================================================================






Become an MFC-L member | Вернуться в корень Архива |