火车售票系统(毕业论文)

number:='number'+riqi+leixing;

num_a:=ADOQuery1.FieldValues[amount]; num_num:=ADOQuery1.FieldValues[number];

if num_a>0 then begin

Qbuy:=TADOQuery.Create(nil); with Qbuy do begin

Connection:=ADOConnection1; if leixing='7' then begin

zuo:=120; //一节车厢中硬座的个数 SQL.Clear; sqlstr:='update '+amount+'='+inttostr(num_a-1)+'

train_no=\ SQL.Add(sqlstr); ExecSQL;

SQL.Clear; sqlstr:='update

checi

set

train_node

set where

'+number+'='+inttostr(num_num+1)+' train_no=\ SQL.Add(sqlstr); ExecSQL; end else begin

zuo:=60; //一节车厢中卧铺,软卧的个数 sqlstr:='update

checi

where

set

'+amount+'='+inttostr(num_a-1)+','+number+'='+inttostr(num_num+1)+' where train_no=\ SQL.Clear; SQL.Add(sqlstr); ExecSQL; end; Close; end;

//打印车票 ,可以用报表更简单,但我没有装! with form2 do begin show;

zhanm.Caption:=ADOQuery1.FieldValues['zhanm'];

no.Caption:=ADOQuery1.FieldValues['train_node.train_no']; riqi.Caption:=r_riqi.Text;

etime.Caption:=ADOQuery1.FieldValues['emit_time']; xiang.Caption:=inttostr(num_num div zuo); hao.Caption:=inttostr(num_num mod zuo); jiage.Caption:=price.Text; leixing.Caption:=r_leixing.Text; end;

ADOQuery1.Close; ADOQuery1.Open;

ADOQuery1.MoveBy(Distance); end else begin

//GroupBox1.Hide;

Qbuy:=TADOQuery.Create(nil); with Qbuy do begin

Connection:=ADOConnection1; DataSource3.DataSet:=Qbuy; SQL.Clear;

SQL.Add('select * from tui where 目的站=\ Open; end;

if Qbuy.RecordCount<=0 then begin

GroupBox2.Hide;

showmessage('对不起!这趟车的票已经售完.'); end else

GroupBox2.Show; end; end;

procedure Tmain.N7Click(Sender: TObject); begin if log then

main.BitBtn2.Click else

showmessage('请先登陆!谢谢!'); end;

procedure Tmain.N8Click(Sender: TObject);

联系客服:779662525#qq.com(#替换为@)