查询代码:procedure TInfo.Button8Click(Sender: TObject); var MS:TstringStream; //查询 begin if (edit1.Text = '')then begin showmessage('学号不能为空。'); edit1.SetFocus; end else with ADOQuery1 do begin Close; SQL.Clear; SQL.Add('SELECT * FROM StuInfo WHERE StuID = ''' +edit1.Text+'''' ); Open; if IsEmpty then begin showmessage('没有这个学生记录。'); //edit1.SetFocus; button13.Click; end else begin edit2.Text:=ADOQuery1.FieldByName('StuName').AsString; //显示基本信息 edit3.Text:=ADOQuery1.FieldByName('StuBirth').AsString; edit4.Text:=ADOQuery1.FieldByName('StuClass').AsString; edit5.Text:=ADOQuery1.FieldByName('StuFather').AsString; edit6.Text:=ADOQuery1.FieldByName('StuMother').AsString; edit8.Text:=ADOQuery1.FieldByName('FathTele').AsString; edit9.Text:=ADOQuery1.FieldByName('MothTele').AsString; edit7.Text:=ADOQuery1.FieldByName('StuTeaName').AsString; //image1.Picture.Graphic := nil; if ADOQuery1.FieldByName('StuPicture').isNull=false then //显示图片 begin MS:=TstringStream.Create(''); TBlobField(ADOQuery1.FieldByName('StuPicture')).SaveToStream(MS); MS.Position := 0; image1.Picture.Graphic.LoadFromStream(MS); MS.Free; end else begin image1.Picture.Graphic.LoadFromFile('D:\较好版本\333333\并蒂莲.jpg'); end; with ADOQuery7 do begin ADOQuery7.Close; ADOQuery7.SQL.Clear; ADOQuery7.SQL.Add('select * from FingerPrint where StuID = '''+edit1.Text+''' and Relation =''本人'''); ADOQuery7.Open; //edit14.Text:=ADOQuery7.FieldByName('Relation').AsString; if IsEmpty then begin label17.Caption:='指纹没有登记'; end else begin label17.Caption:='指纹已经登记'; end; //info.FormShow(Sender); end; button5.Enabled:=true; button2.Enabled:=true; button7.Enabled:=true; end; end;end;
上一条记录代码 procedure TInfo.Button15Click(Sender: TObject); var MS:TstringStream; //上一条记录 begin //with ADOQuery1 do ADOQuery1.Prior; if not ADOQuery1.Bof then begin Button15.Enabled := true; end else begin Button15.Enabled := false; Button17.Enabled:=false; end; edit2.Text:=ADOQuery1.FieldByName('StuName').AsString; edit1.Text:=ADOQuery1.FieldByName('StuID').AsString; edit3.Text:=ADOQuery1.FieldByName('StuBirth').AsString; edit4.Text:=ADOQuery1.FieldByName('StuClass').AsString; edit5.Text:=ADOQuery1.FieldByName('StuFather').AsString; edit6.Text:=ADOQuery1.FieldByName('StuMother').AsString; edit8.Text:=ADOQuery1.FieldByName('FathTele').AsString; edit9.Text:=ADOQuery1.FieldByName('MothTele').AsString; edit7.Text:=ADOQuery1.FieldByName('StuTeaName').AsString; //image1.Picture.Graphic := nil; if ADOQuery1.FieldByName('StuPicture').isNull=false then begin MS:=TstringStream.Create(''); TBlobField(ADOQuery1.FieldByName('StuPicture')).SaveToStream(MS); MS.Position := 0; image1.Picture.Graphic.LoadFromStream(MS); MS.Free; end else begin image1.Picture.Graphic.LoadFromFile('D:\较好版本\333333\并蒂莲.jpg'); end;
var
MS:TstringStream; //查询
begin
if (edit1.Text = '')then
begin
showmessage('学号不能为空。');
edit1.SetFocus;
end
else
with ADOQuery1 do
begin
Close;
SQL.Clear;
SQL.Add('SELECT * FROM StuInfo WHERE StuID = ''' +edit1.Text+'''' );
Open;
if IsEmpty then
begin
showmessage('没有这个学生记录。');
//edit1.SetFocus;
button13.Click;
end
else
begin
edit2.Text:=ADOQuery1.FieldByName('StuName').AsString; //显示基本信息
edit3.Text:=ADOQuery1.FieldByName('StuBirth').AsString;
edit4.Text:=ADOQuery1.FieldByName('StuClass').AsString;
edit5.Text:=ADOQuery1.FieldByName('StuFather').AsString;
edit6.Text:=ADOQuery1.FieldByName('StuMother').AsString;
edit8.Text:=ADOQuery1.FieldByName('FathTele').AsString;
edit9.Text:=ADOQuery1.FieldByName('MothTele').AsString;
edit7.Text:=ADOQuery1.FieldByName('StuTeaName').AsString;
//image1.Picture.Graphic := nil;
if ADOQuery1.FieldByName('StuPicture').isNull=false then //显示图片
begin
MS:=TstringStream.Create('');
TBlobField(ADOQuery1.FieldByName('StuPicture')).SaveToStream(MS);
MS.Position := 0;
image1.Picture.Graphic.LoadFromStream(MS);
MS.Free;
end
else
begin
image1.Picture.Graphic.LoadFromFile('D:\较好版本\333333\并蒂莲.jpg');
end;
with ADOQuery7 do
begin
ADOQuery7.Close;
ADOQuery7.SQL.Clear;
ADOQuery7.SQL.Add('select * from FingerPrint where StuID = '''+edit1.Text+''' and Relation =''本人''');
ADOQuery7.Open;
//edit14.Text:=ADOQuery7.FieldByName('Relation').AsString;
if IsEmpty then
begin
label17.Caption:='指纹没有登记';
end
else
begin
label17.Caption:='指纹已经登记';
end;
//info.FormShow(Sender);
end;
button5.Enabled:=true;
button2.Enabled:=true;
button7.Enabled:=true;
end;
end;end;
procedure TInfo.Button15Click(Sender: TObject);
var
MS:TstringStream; //上一条记录
begin
//with ADOQuery1 do
ADOQuery1.Prior;
if not ADOQuery1.Bof then
begin
Button15.Enabled := true;
end
else
begin
Button15.Enabled := false;
Button17.Enabled:=false;
end;
edit2.Text:=ADOQuery1.FieldByName('StuName').AsString;
edit1.Text:=ADOQuery1.FieldByName('StuID').AsString;
edit3.Text:=ADOQuery1.FieldByName('StuBirth').AsString;
edit4.Text:=ADOQuery1.FieldByName('StuClass').AsString;
edit5.Text:=ADOQuery1.FieldByName('StuFather').AsString;
edit6.Text:=ADOQuery1.FieldByName('StuMother').AsString;
edit8.Text:=ADOQuery1.FieldByName('FathTele').AsString;
edit9.Text:=ADOQuery1.FieldByName('MothTele').AsString;
edit7.Text:=ADOQuery1.FieldByName('StuTeaName').AsString;
//image1.Picture.Graphic := nil;
if ADOQuery1.FieldByName('StuPicture').isNull=false then
begin
MS:=TstringStream.Create('');
TBlobField(ADOQuery1.FieldByName('StuPicture')).SaveToStream(MS);
MS.Position := 0;
image1.Picture.Graphic.LoadFromStream(MS);
MS.Free;
end
else
begin
image1.Picture.Graphic.LoadFromFile('D:\较好版本\333333\并蒂莲.jpg');
end;
Application.ProcessMessages;