【delphi开源代码栏目提醒】:网学会员delphi开源代码为您提供runout.pas参考,解决您在runout.pas学习中工作中的难题,参考学习。
unit runout;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, DB, ADODB, StdCtrls, Grids, DBGrids ,work_info_unit, DBClient,
ComCtrls, ExtCtrls;
type
Trunoutfrm = class(TForm)
DBGrid1: TDBGrid;
Button1: TButton;
Button2: TButton;
Panel1: TPanel;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
Label5: TLabel;
Label6: TLabel;
Label14: TLabel;
Edit1: TEdit;
Edit2: TEdit;
DateTimePicker1: TDateTimePicker;
Edit9: TEdit;
Edit10: TEdit;
Edit11: TEdit;
Panel2: TPanel;
Label7: TLabel;
Label8: TLabel;
Label9: TLabel;
Label10: TLabel;
Label11: TLabel;
Label12: TLabel;
Label13: TLabel;
Edit3: TEdit;
Edit4: TEdit;
Edit5: TEdit;
Edit6: TEdit;
Edit7: TEdit;
Edit8: TEdit;
ClientDataSet1: TClientDataSet;
DataSource1: TDataSource;
procedure Button2Click(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure DBGrid1CellClick(Column: TColumn);
private
work_info:Twork_info ;
{ Private declarations }
public
{ Public declarations }
end;
var
runoutfrm: Trunoutfrm;
implementation
uses mainfrmunit2;
{$R *.dfm}
procedure Trunoutfrm.Button2Click(Sender: TObject);
begin
//实例化类
work_info:=Twork_info.create ;
if work_info.CheckRec(edit9.text)=false then //如果找不到对应的记录,提示用户出错
begin
showmessage('对不起,该运营不存在!');
exit;
end;
//将对应的查询结果显示出来
edit1.Text :=work_info.GetVehicleId(edit9.Text);
edit2.Text :=work_info.GetPEOPLE(edit9.Text);
edit3.Text :=work_info.GetCLIENT(edit9.Text) ;
edit4.Text :=work_info.GetORDERNO(edit9.Text) ;
edit5.Text :=work_info.GetBEGiNADD(edit9.Text) ;
edit6.Text :=work_info.GetENDADD(edit9.Text);
edit7.Text :=work_info.GetLONGTH(edit9.Text);
edit8.Text :=work_info.Getmoney(edit9.Text);
edit10.Text :=work_info.GetDRIVERID(edit9.Text) ;
edit11.Text :=work_info.GetVEHICLENO(edit9.Text) ;
datetimepicker1.DateTime:=strtodate(work_info.GetBEGINTIME(edit9.Text) ) ;
//释放实例
work_info.Free;
end;
procedure Trunoutfrm.Button1Click(Sender: TObject);
var sql:string;
begin
//创建类的实例
work_info:=Twork_info.create ;
//赋值查询语句
sql:='select YUNDAN_ID 运单编号,'
+' VEHICLE_NO 车辆编号 ,'
+' VEHICLE_ID 车牌号 ,'
+' DRIVER_ID 司机编号 ,'
+' PEOPLE 随车人员 ,'
+' BEGAIN_TIME 出车时间,'
+' CLIENT 客户名称 ,'
+' ORDER_NO 订单号 ,'
+' GEGAIN_ADD 起始地 ,'
+' END_ADD 发货地 ,'
+' LONGTH 公里数 ,'
+' MONEY 运费 ,'
+' REMARK 备注 FROM work_info';
//执行
查询方法并用
列表显示出来
clientdataset1.data:=work_info.AllRec(sql);
//释放实例
work_info.Free;
end;
procedure Trunoutfrm.DBGrid1CellClick(Column: TColumn);
begin
//实例化类
work_info:=Twork_info.create ;
edit9.text:=DBGrid1.Fields[0].AsString ;
if work_info.CheckRec(edit9.text)=false then //如果找不到对应的记录,提示用户出错
begin
showmessage('对不起,该运营不存在!');
exit;
end;
//将对应的查询结果显示出来
edit1.Text :=work_info.GetVehicleId(edit9.Text);
edit2.Text :=work_info.GetPEOPLE(edit9.Text);
edit3.Text :=work_info.GetCLIENT(edit9.Text) ;
edit4.Text :=work_info.GetORDERNO(edit9.Text) ;
edit5.Text :=work_info.GetBEGiNADD(edit9.Text) ;
edit6.Text :=work_info.GetENDADD(edit9.Text);
edit7.Text :=work_info.GetLONGTH(edit9.Text);
edit8.Text :=work_info.Getmoney(edit9.Text);
edit10.Text :=work_info.GetDRIVERID(edit9.Text) ;
edit11.Text :=work_info.GetVEHICLENO(edit9.Text) ;
datetimepicker1.DateTime:=strtodate(work_info.GetBEGINTIME(edit9.Text) ) ;
//释放实例
work_info.Free;
end;
end.