在access数据库和delphi写的程序中,怎样实现:在界面上的文本框(edit1.txt)输入工号(person_no)后,按"提交"按钮时,系统找到该员工记录,把文本框(edit2.txt)中的金额替换成工资表(gz_table)中该员工的金额.

解决方案 »

  1.   

    ADOQuery.CLose;
    ADOQuery.SQL.Clear;
    ADOQuery.SQL.Add('Select * From gz_table where person_no='+''''+Edit1.text+'''');
    ADOQuery.open;
    if ADOQuery.RecordCount>0 then
     Edit2.text:=ADOQuery.FieldByName('工资').asString;
      

  2.   

    karl(多功能算术逻辑运算单元)大哥,你真行,这问题搞定了.
      

  3.   

    不过,如果要是没有满足条件的记录,要用showmessage('没有满足条件的记录');提示,那要怎样写?
      

  4.   

    ADOQuery.CLose;
    ADOQuery.SQL.Clear;
    ADOQuery.SQL.Add('Select * From gz_table where person_no='+''''+Edit1.text+'''');
    ADOQuery.open;
    if ADOQuery.RecordCount>0 then
     Edit2.text:=ADOQuery.FieldByName('工资').asStringelseshowmessage('没有满足条件的记录');