多个image字段查询(200)

K

keke123

Unregistered / Unconfirmed
GUEST, unregistred user!
procedure fitmentDisply(fitmentNo:integer;fitmentName:string;KeyfieldName0:string;KeyfieldName1:string);var inputFileType:string; FilePath:string; hasRecord:boolean;begin hasRecord:=false; if KeyfieldName0='' then begin messagebox(explosionProperty_u.explosionPropertyfrm.handle, pchar('请输入编号') ,'警告!!',MB_OK+MB_ICONWARNING); exit; end; try BZ_Data_u.BZ_Data_frm.explosionProperty_image.Active:=false; BZ_Data_u.BZ_Data_frm.explosionProperty_image.DataSet.CommandText:='select '+ ImageFields+','+ImageTypeFields+' from explosionProperty where '+db_fields[1]+' =' + ''''+KeyfieldName0 + ''''; //showmessage(BZ_Data_u.BZ_Data_frm.explosionProperty_image.DataSet.CommandText); BZ_Data_u.BZ_Data_frm.explosionProperty_image.Active:=true; if not BZ_Data_u.BZ_Data_frm.explosionProperty_image.eof then begin if BZ_Data_u.BZ_Data_frm.explosionProperty_image56.Value<>'' then begin inputFileType:=BZ_Data_u.BZ_Data_frm.explosionProperty_image.FieldValues[db_fields[62]]; FilePath:='C:/WINDOWS/system32/tmp'+inputFileType; BZ_Data_u.BZ_Data_frm.explosionProperty_image56.SaveToFile(FilePath); try if ShellExecute(explosionProperty_u.explosionPropertyfrm.handle,'',pchar(FilePath),'nil','',SW_SHOW)=SE_ERR_NOASSOC then begin showmessage(); exit; end; except showmessage(); exit; end; end else begin showmessage(); exit; end; except showmessage(); exit; end ; end;这里explosionProperty_image是一个simpledataset控件,里面添加了多个image字段的名称以及image字段对应的文件类型字段名称。问题1:在查询的时候必须要把所有explosionProperty_image的image字段名和类型名都写上,否则就会报错“field not found”,这样即使我只想查找其中一个image字段也必须把其他几个一起查出来 我应该怎么做才能只查询一个?问题2:多个一起查询时还遇到问题,那就是如果某个image字段中的文件比较大(1M以上),通过savetofile方式存储的文件就会被破坏,不能正常显示。可以排除的时录入时就出错,因为我用只放单个image字段的simpledataset控件试过。请兄弟姐妹们帮帮忙啊! 谢谢大家了
 

Similar threads

S
回复
0
查看
3K
SUNSTONE的Delphi笔记
S
S
回复
0
查看
2K
SUNSTONE的Delphi笔记
S
顶部