插入图片 问题 大哥帮忙
<P>这是我的代码</P><P> if(OpenPictureDialog1->Execute())</P>
<P> {
TMemoryStream *pm=new TMemoryStream();
Image1->Picture->LoadFromFile(OpenPictureDialog1->FileName);
TJPEGImage *jpg=dynamic_cast<TJPEGImage*>(Image1->Picture->Graphic);
if(jpg!=NULL)
jpg->SaveToStream(pm);
else
Image1->Picture->Bitmap->SaveToStream(pm);
ClientDataSet1->CommandText="insert into student1 (name1,name2,pic) values ('1','1',:picture)";</P>
<P> ((TBlobField*)(ClientDataSet1->Params->ParamByName("picture")))->LoadFromStream(pm);
delete pm;
ClientDataSet1->Execute();
}</P>
<P>在运行期间出错误 </P>
<P>Prject project1.exe raised exception class
EAcessViolation with message ' Acess violation at address 40325fa4 in model
' dbrtl60.bpl ' read of address 94636b84</P>
<P>请问大哥们改如何的改正</P>
<P>谢谢!!</P> <P>((TBlobField*)(ClientDataSet1->Params->ParamByName("picture")))->LoadFromStream(pm);这句的问题!</P><P>TBlobField类是一个字段类!不能将参数转成字段!关于类的说明参见本版的帖子!</P>
页:
[1]