A
andy0925
Unregistered / Unconfirmed
GUEST, unregistred user!
我很菜!
我想把在数据库中查询到的name显示在label上
代码如下:
procedure TForm1.FormShow(Sender: TObject);
begin
panel2.Hide;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
if edit1.Text='' then
showmessage('请输入工号,工号不能够为空!')
else
begin
adoquery1.Close;
adoquery1.SQL.Clear;
adoquery1.SQL.Add('select * from T_yf_workername where workerid=:workerid');
adoquery1.Parameters.ParamByName('workerid').Value:=edit1.text;
adoquery1.Open;
if adoquery1.RecordCount<1 then
showmessage('您输入的工号不正确,请核对后再输')
else
begin
panel2.Show;
label5.Caption:=edit1.Text;
adoquery1.Close;
adoquery1.SQL.Clear;
adoquery1.SQL.Add('select name from T_yf_workername where workerid=:workerid');
adoquery1.Prepared;
adoquery1.Open;
label3.caption:=adoquery1.fieldbyname('name').asstring;
adoquery1.Close;
adoquery1.SQL.Clear;
adoquery1.SQL.Add('select SLCid from t_z_upworkdown where workerid=:workerid');
adoquery1.Open;
label7.Caption:=adoquery1.fieldbyname('SLCID').AsString;
end
end
end;
这问题就是label3和label7都不显示
我想把在数据库中查询到的name显示在label上
代码如下:
procedure TForm1.FormShow(Sender: TObject);
begin
panel2.Hide;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
if edit1.Text='' then
showmessage('请输入工号,工号不能够为空!')
else
begin
adoquery1.Close;
adoquery1.SQL.Clear;
adoquery1.SQL.Add('select * from T_yf_workername where workerid=:workerid');
adoquery1.Parameters.ParamByName('workerid').Value:=edit1.text;
adoquery1.Open;
if adoquery1.RecordCount<1 then
showmessage('您输入的工号不正确,请核对后再输')
else
begin
panel2.Show;
label5.Caption:=edit1.Text;
adoquery1.Close;
adoquery1.SQL.Clear;
adoquery1.SQL.Add('select name from T_yf_workername where workerid=:workerid');
adoquery1.Prepared;
adoquery1.Open;
label3.caption:=adoquery1.fieldbyname('name').asstring;
adoquery1.Close;
adoquery1.SQL.Clear;
adoquery1.SQL.Add('select SLCid from t_z_upworkdown where workerid=:workerid');
adoquery1.Open;
label7.Caption:=adoquery1.fieldbyname('SLCID').AsString;
end
end
end;
这问题就是label3和label7都不显示