问一个初级的问题(50分)

  • 主题发起人 主题发起人 lostangelnj
  • 开始时间 开始时间
L

lostangelnj

Unregistered / Unconfirmed
GUEST, unregistred user!
procedure TForm1.Button1Click(Sender: TObject);<br>begin<br>with qry do<br>&nbsp; begin<br>&nbsp; &nbsp; active:=false;<br>&nbsp; &nbsp; sql.add('select *from xscj where number='+edit6.text);<br>&nbsp; &nbsp; active:=true;<br>&nbsp; &nbsp; first;<br>&nbsp; &nbsp; while not eof do<br>&nbsp; &nbsp; begin<br>&nbsp; &nbsp; edit1.Text:=inttostr(fieldbyname('number').asinteger);<br>&nbsp; &nbsp; edit2.Text:=fieldbyname('name').asstring;<br>&nbsp; &nbsp; edit3.Text:=inttostr(fieldbyname('ywcj').asinteger);<br>&nbsp; &nbsp; edit4.Text:=inttostr(fieldbyname('sxcj').asinteger);<br>&nbsp; &nbsp; edit5.Text:=inttostr(fieldbyname('yycj').asinteger);<br>&nbsp; &nbsp; next;<br>&nbsp; &nbsp; end;<br>&nbsp; &nbsp; active:=false;<br>&nbsp; end;<br><br>end;<br>想实现一个简单的搜索功能,但输入一次够,修改数值,它就报错..说语法错误...高手能指点下么...
 
sql.add之前要sql.Clear<br>edit6.text是数字?<br>下面的写法很诡异。。。。。。。。。<br>first;<br>&nbsp; &nbsp; while not eof do<br>&nbsp; &nbsp; begin<br>&nbsp; &nbsp; edit1.Text:=inttostr(fieldbyname('number').asinteger);<br>&nbsp; &nbsp; edit2.Text:=fieldbyname('name').asstring;<br>&nbsp; &nbsp; next;
 
加上sql.Clear就正确了..额 我是新手..后面的代码是导师写的..
 

Similar threads

S
回复
0
查看
694
SUNSTONE的Delphi笔记
S
S
回复
0
查看
655
SUNSTONE的Delphi笔记
S
S
回复
0
查看
870
SUNSTONE的Delphi笔记
S
S
回复
0
查看
3K
SUNSTONE的Delphi笔记
S
S
回复
0
查看
2K
SUNSTONE的Delphi笔记
S
后退
顶部