vs2010 MFC vc++如何保存和显示数据库中的JPG图片代码?

从本地磁盘中读取一张JPG格式的图片到vs2010 MFC界面上,把此图片保存到sql server2008数据库中,并可以从数据库中读取图片在界面上显示出来.
数据库连接是
UpdateData(TRUE);
CoInitialize(NULL);
ConnectionPtr pConn(_uuidof(Connection));
RecordsetPtr pRst(_uuidof(Recordset));
pConn->ConnectionString=(_T("Provider=SQLOLEDB.1;User ID=sa;Password=123456;Persist Security Info=True;Data Source=localhost;Initial Catalog=test"));
pConn->Open(_T(""),_T(""),_T(""),adConnectUnspecified);
pRst=pConn->Execute(_T("select * from information"),NULL,adCmdText);

我建议改成数据库存取图片路径,然后显示图片。显示JPG格式的图片

http://wenku.baidu.com/link?url=zlaQLdUygPxlbbqYyoNrsH24yP__kcQo7DA0Ycr1DQn4UF8xeKy7Grk4Y3Os924qMkb0-8hKpWtevBngccPUiRMZLVDGx8d1kcV1VYCn73O
http://www.cnblogs.com/joinclear/archive/2010/11/18/1881245.html

如果你是存图片路径的话就好写了。

```CImage image;
image.Load(你查询的图片字符串);
//然后找到显示的地方 比如一个pic控件,ID为ID_PIC 则

CStatic idc=CStatic)GetDlgItem(IDC_PIC);
CRect m_picRect1;
idc->GetClientRect(&m_picRect1);
CDC* cd = idc_photo->GetWindowDC();
int width = img.GetWidth();
int height = img.GetHeight();
SetStretchBltMode(cd->m_hDC, HALFTONE);
img.Draw(cd->m_hDC, m_picRect1);
ReleaseDC(cd);