|
我在该Form里创建的时候打开表 Query1 , Query2 , Query3
并且Query1里的查询语句如下:
select student.s_no ,s_name , s_sex , s_age , s_address , s_nation ,s_college , s_subject , s_class , s_grade ,s_phone , s_picture , building.building_no , house.house_no , bed_no
from building , house , bed ,student
where building.building_no = house.building_no And house.house_no = bed.house_no And bed.s_no = student.s_no
//Query1的AfterScroll事件如下:
//但是运行的时候出现错误,错误行我在程序里给出
procedure TAdmin_Operation_Form_AlterStudent.Query1AfterScroll(DataSet:TDataSet);
var
MyJpeg : TJpegImage ;
MyStm : TMemoryStream ;
begin
query2.Close ;
query2.SQL.Clear ;
query2.SQL.Add('select * from house where building_no = :para_building_no') ;
query2.SQL.Add(' AND house_no = :para_house_no') ;
query2.ParamByName('para_building_no').AsString := query1.fieldByName('building.building_no').AsString ;
//上面那行错误,说'building.building_no'字段不存在,这是怎么回事!
query2.ParamByName('para_house_no').AsString := query1.fieldByName('house.house_no').AsString ;
query2.Open ;
query3.Close ;
query3.SQL.Clear ;
query3.SQL.Add('select * from bed where bed_no = :para_bed_no') ;
query3.ParamByName('para_bed_no').AsString := query1.fieldByName('bed_no').AsString ;
query3.Open ;
query4.Close ;
query4.SQL.Clear ;
query4.SQL.Add('select * from student where s_no = :para_s_no') ;
query4.ParamByName('para_s_no').AsString := query1.fieldByName('bed_no').AsString ;
query4.Open ;
if not query4.FieldByName('s_picture').IsNull then
begin
try
MyJpeg:=TJpegImage.Create;
MyStm:=TMemoryStream.Create;
MyStm.Clear;
query4.Edit ;
TBlobField(query4.FieldByName('s_picture')).SaveToStream(MyStm);
MyStm.Position:=0;
MyJpeg.LoadFromStream(MyStm);
Image1.Picture.BitMap.Assign(MyJpeg);
finally
MyJpeg.Free;
MyStm.Free;
end;
end
end;
希望哪位大侠帮帮忙,看看我是哪里错???
谢谢大家了!! |
|