train_node.train_no=checi.train_no '+sq); Open; end;
if sq<>'' then GroupBox1.Show else
GroupBox1.Hide;
if Adoquery1.RecordCount>0 then begin
if edit1.Text='' then begin
train_no.Items.Clear; while not Adoquery1.Eof do begin
train_no.Items.Add(Adoquery1.FieldValues['train_node.train_no']); Adoquery1.Next; end;
Adoquery1.First; zhanm.Text:=edit2.Text;
train_no.ItemIndex:=0; Distance:=Adoquery1.RecNo-1; end;
if edit2.Text='' then begin
zhanm.Items.Clear; while not Adoquery1.Eof do begin
zhanm.Items.Add(Adoquery1.FieldValues['zhanm']); Adoquery1.Next; end;
Adoquery1.First; train_no.Text:=edit1.Text; zhanm.ItemIndex:=0;
Distance:=Adoquery1.RecNo-1; end;
amount.DataField:='amount'+riqi+leixing; price.DataField:='price'+leixing; end else begin
GroupBox1.Hide;
showmessage('对不起!目前此列车还未开通!请选乘就近的火车站');
Edit1.Text:=''; Edit2.Text:=''; end;
GroupBox2.Hide; end;
procedure Tmain.train_noChange(Sender: TObject); begin
Adoquery1.MoveBy(train_no.ItemIndex-Distance); Distance:=train_no.ItemIndex; end;
procedure Tmain.zhanmChange(Sender: TObject); begin
Adoquery1.MoveBy(zhanm.ItemIndex-Distance); Distance:=zhanm.ItemIndex; end;
procedure Tmain.r_riqiChange(Sender: TObject);
begin
riqi:=inttostr(r_riqi.ItemIndex);
amount.DataField:='amount'+riqi+leixing; price.DataField:='price'+leixing; end;
procedure Tmain.r_leixingChange(Sender: TObject); begin
leixing:=inttostr(r_leixing.ItemIndex+7); amount.DataField:='amount'+riqi+leixing; price.DataField:='price'+leixing; end;
procedure Tmain.buyClick(Sender: TObject); var Qbuy:TADOQuery; amount,number:string; sqlstr:string;
num_a,num_num,zuo:integer; begin
amount:='amount'+riqi+leixing;