|
-
November 26th, 2002, 07:49 AM
#1
Saving Image Files in SQL database using ADO
Hi
I am currently on a project which I require to store and retrieve image files (bmp) into MS SQL. I am a newbie programmer and seriously need some help with this.
I have already written a custom record class :
//CustomRs.h
#pragma once
#define INITGUID
#import "C:\Program Files\Common Files\System\ADO\msado15.dll" rename_namespace("ADOCG") rename("EOF", "EndOfFile")
using namespace ADOCG;
#include "icrsint.h"
class CCustomRs :
public CADORecordBinding
{
BEGIN_ADO_BINDING(CCustomRs)
ADO_VARIABLE_LENGTH_ENTRY2(1, adVarChar, m_szMatric,
sizeof(m_szMatric), lMatricStatus, TRUE)
ADO_VARIABLE_LENGTH_ENTRY2(2, adVarChar, m_szTest,
sizeof(m_szTest), lTestStatus, TRUE)
ADO_VARIABLE_LENGTH_ENTRY2(3, adLongVarBinary, m_szImage,
sizeof(m_szImage), lImageStatus, TRUE)
END_ADO_BINDING()
public:
CHAR m_szMatric[51];
ULONG lMatricStatus;
CHAR m_szTest[51];
ULONG lTestStatus;
BYTE m_szImage;
ULONG lImageStatus;
};
I would like to bind my image file found on "c:/test.bmp" to be stored into my SQL table.
I have already successfully managed to store strings into SQL table using this method. However, it seems like storing image files require much more effort.
Hope someone can write some sample code that uses my custom record class to save image into database.
Thanks in advance!!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|