|
When I created the form, I opened the tables Query1, Query2, Query3
And the query in Query1 is as follows:
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's AfterScroll event is as follows:
// But there is an error when running, I give the error line in the program
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;
// The above line is wrong, saying that the 'building.building_no' field does not exist.
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;
Which hero would you like to help and see where I am wrong? ? ?
Thank you all! !! |
|