--新建表image create table image(img_id int,img image)
拖控件
TADOQuery
包含Jpeg.hpp
//存入图片: //image以二进制形式存放图片
ADOQuery1->Close();
ADOQuery1->SQL->Clear();
ADOQuery1->SQL->Add("insert into image values(:img_id,:img)");
ADOQuery1->Parameters->Items[0]->Value=1;
ADOQuery1->Parameters->Items[1]->LoadFromFile("c:/3.jpg",ftBlob);
ADOQuery1->ExecSQL();
//取图片
TMemoryStream *stream=new TMemoryStream;
TJPEGImage *jpg=new TJPEGImage;
ADOQuery1->Close();
ADOQuery1->SQL->Clear();
ADOQuery1->SQL->Add("select *from infos where img_id=1");
ADOQuery1->Open();
(TBlobField*)ADOQuery1->FieldByName("img")->SaveToStream(stream);
stream->Postion=0;
jpg->LoadFromStream(stream);
Canvas->Draw(0,0,jpg);
delete jpg;
delete stream;