Article ID: 189415 - Last Review: March 2, 2005 - Revision: 4.4 AdoChunk.exe Using GetChunk and AppendChunk in Visual C++
This article was previously published under Q189415 SUMMARY
AdoChunk.exe is a sample that demonstrates using the GetChunk and
AppendChunk methods with Visual C++ version 5.0. The sample also
demonstrates the use of recordset navigation functions.
MORE INFORMATIONThe following file is available for download from the Microsoft Download Center: http://download.microsoft.com/download/vc50pro/Info/1/WIN98/EN-US/ADOCHUNK.EXE
(http://download.microsoft.com/download/vc50pro/info/1/win98/en-us/adochunk.exe)
NOTE: After you click the preceding link, please select Save this program to disk from the File Download dialog box. Next, click Run on the Start
menu and run the .exe file with the -d attribute, as shown in the following
example:
C:\<directory name>\Adochunk.exe 119591
(http://support.microsoft.com/kb/119591/EN-US/
)
How to Obtain Microsoft Support Files from Online Services
Microsoft scanned this file for viruses. Microsoft used the most current virus-detection software that was available on the date that the file was posted. The file is stored on security-enhanced servers that help to prevent any unauthorized changes to the file.
This sample uses the #import feature of Visual C++. This is a MFC dialog-based application. It operates on a Microsoft Access database table having two columns; "Name" of type Text, and "BlobData" of type OLE Object. The following files are included in the sample project:
File Name Description
------------------------------------------------------------------------
CAdoVcChunkDlg.h CDialog derived class declaration. This class
has a member variable of type _RecordsetPtr
CAdoVcChunkDlg.cpp Implementation for the Dialog with different
message handlers using ADO and updating the
different controls.
CAdoVcChunk.h CWinApp derived class header file.
CAdoVcChunk.cpp CWinApp derived class.
MoveNext, MovePrevious, MoveFirst and MoveLast:
Clicking these buttons enables the user to navigate through the
recordset. Navigating from one record to another saves the record
data if the record is modified.
Browse:
Displays a File Open dialog box. Selecting a file to open fills the
contents of the edit box (showing the details column data) with the
contents of the file selected.
AddNew:
Adds a new record with data present in the different
controls of the dialog.
Close:
Closes the recordset.
DumpError(_com_error &e):
This function is called from all the other functions in the
_com_error exception handler. This function retrieves information on
the error and displays an error message box.
Update():
This function retrieves data from the recordset and updates the
different controls. The function uses the GetChunk method to retrieve
the BlobData field. The data retrieved from the BlobData field is a
Safearray of bytes. The code for this function follows:
This function reads the binary data from the edit control and
converts it to a variant containing a SafeArray of bytes.
This function reads data from the edit controls and updates the
database. The function is called whenever navigation action is
performed. This function uses the AppendChunk method to update data
to the database. The code is as follows:
REFERENCES
For additional information, please see the following article in the
Microsoft Knowledge Base:
220152
(http://support.microsoft.com/kb/220152/EN-US/
)
Sample: ADOVC1 Simple ADO/VC++ Application
APPLIES TO
| Other Resources Other Support Sites
CommunityArticle Translations |






Windows Live
Facebook
Twitter
Linkedin
Digg it
Yahoo
Delicious
StumbleUpon
Yammer
Reddit
Technorati
FriendFeed
Email
Back to the top