try num:=strtoint(edit1.text); sql.txt:='select * from edit where ht_num='+edit1.text; qury.open; if qury.recordcount<1 then ...没有这个记录 except //不合法的数字 end;
谢谢大哥了!那要是通过一个按钮删除两个表里的内容呢procedure TForm4.BitBtn1Click(Sender: TObject); begin with dm.ADOQuery1 do begin close; sql.Clear; sql.Text:='delete * from edit where ht_num = '+quotedstr(edit1.Text+'); open; close; sql.Clear; sql.Text:='delete * from chanpin where ht_num = '+quotedstr(edit1.Text+'); open; end; end; 这样只删除了表edit的内容,没有删除表chanpin的内容
----------------------------------------------
我是菜鸟!
procedure TForm4.BitBtn9Click(Sender: TObject); begin with dm.ADOQuery1 do begin close; sql.Clear; sql.Text:='update edit set ht_num = '+quotedstr(edit1.Text+'); try open; except execsql; end; end; 这样不能保存修改后的数据啊?