GIDForums  

Go Back   GIDForums > Computer Programming Forums > C++ Forum
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 30-Jan-2009, 03:55
Priya87 Priya87 is offline
New Member
 
Join Date: Jan 2009
Posts: 1
Priya87 is on a distinguished road

Loading and storing a CLongBinary data


Hi

I am havin a problem in loading and storing a CLongBinary data from and to a database.

I am using MS access database and I am trying to store a binary form of Cstring data in to the database field which is of type oleobject.

This is the part of my code where i am trying to store.

Please help me out this code :


CPP / C++ / C Code:
trial_obj.Open(); // MFC Wizard class created in vc++

trial_obj.AddNew(); 



pVoid = NULL;

len = str.GetLength()+1;

trial_obj.m_data2.m_hData = ::GlobalAlloc(GPTR,len); // trial_obj.m_data2 is a oleobject field in database 

pVoid = ::GlobalLock(trial_obj.m_data2.m_hData);

::memcpy(pVoid,(LPSTstr.GetData(),len);

::GlobalUnlock(trial_obj.m_data2.m_hData);

trial_obj.m_data2.m_dwDataLength =::GlobalSize(trial_obj.m_data2.m_hData);

trial_obj.Update(); 

trial_obj.Close();
Last edited by LuciWiz : 30-Jan-2009 at 07:20. Reason: Please insert your C++ code between [cpp] & [/cpp] tags
 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Network Sites: GIDNetwork · GIDApp · GIDBlog · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 10:03.


vBulletin, Copyright © 2000 - 2014, Jelsoft Enterprises Ltd.