主题:显示记录问题
我用 C++BUilder 6.0 +MS SQL2000编写数据库程序,使用ADO组件数据库服务器,在数据表中有一名为“phto”的Image型字段,通过单击Grid控件,移动记录指针,显示不同记录内容,包括"phto"字段,我在ADOTable控件的AfterScorll事件中编写代码实现,但只能显示最后一条记录,且程序无反应(在Delphi中能够实现),求教如何做?
主要是库中JPEG型图片显示在Image1框中的问题,我操作的代码为:
TMemoryStream *pstream;
TBlobField *bf;
TJPEGImage *jpegm;
bf=(TBlobField*)ATable2->FieldByName("phto");
if(!bf->IsNull )
{ pstream=new TMemoryStream();
jpegm=new TJPEGImage();
try
{ Image1->Picture->Graphic=NULL;
bf->SaveToStream(pstream);
pstream->Position=0;
jpegm->LoadFromStream(pstream);
Image1->Picture->Graphic=jpegm;
}
__finally
{ delete pstream;
delete bf;
delete jpegm;
}
}
主要是库中JPEG型图片显示在Image1框中的问题,我操作的代码为:
TMemoryStream *pstream;
TBlobField *bf;
TJPEGImage *jpegm;
bf=(TBlobField*)ATable2->FieldByName("phto");
if(!bf->IsNull )
{ pstream=new TMemoryStream();
jpegm=new TJPEGImage();
try
{ Image1->Picture->Graphic=NULL;
bf->SaveToStream(pstream);
pstream->Position=0;
jpegm->LoadFromStream(pstream);
Image1->Picture->Graphic=jpegm;
}
__finally
{ delete pstream;
delete bf;
delete jpegm;
}
}