unit u_code_city; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, dxExEdtr, BusinessSkinForm, dxTL, dxDBCtrl, dxDBGrid, dxCntner, bsSkinCtrls, ExtCtrls, StdCtrls, DB, ADODB; type Tfrm_code_city = class(TForm) Panel1: TPanel; bsSkinButton1: TbsSkinButton; bsSkinButton2: TbsSkinButton; bsSkinButton4: TbsSkinButton; bsSkinButton3: TbsSkinButton; bsSkinButton5: TbsSkinButton; dxDBGrid1: TdxDBGrid; bsBusinessSkinForm1: TbsBusinessSkinForm; dxDBGrid1Column1: TdxDBGridMaskColumn; dxDBGrid1Column2: TdxDBGridMaskColumn; dxDBGrid1Column3: TdxDBGridMaskColumn; bsSkinPanel1: TbsSkinPanel; Edit1: TEdit; Label1: TLabel; Edit3: TEdit; Label3: TLabel; bsSkinSpeedButton1: TbsSkinSpeedButton; t_code_city: TADOQuery; t_code_city1: TDataSource; procedure FormShow(Sender: TObject); procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean); procedure bsSkinButton5Click(Sender: TObject); procedure bsSkinButton3Click(Sender: TObject); procedure bsSkinButton2Click(Sender: TObject); procedure bsSkinButton4Click(Sender: TObject); procedure bsSkinButton1Click(Sender: TObject); procedure t_code_cityBeforePost(DataSet: TDataSet); procedure bsSkinSpeedButton1Click(Sender: TObject); procedure Edit1KeyPress(Sender: TObject; var Key: Char); procedure t_code_cityNewRecord(DataSet: TDataSet); private { Private declarations } public { Public declarations } end; var frm_code_city: Tfrm_code_city; implementation uses u_data_share, my_sys_function, u_main; {$R *.dfm} procedure Tfrm_code_city.FormShow(Sender: TObject); begin t_code_city.open; end; procedure Tfrm_code_city.FormCloseQuery(Sender: TObject; var CanClose: Boolean); begin CanClose:=frm_close_query(t_code_city); t_code_city.close; end; procedure Tfrm_code_city.bsSkinButton5Click(Sender: TObject); begin close; end; procedure Tfrm_code_city.bsSkinButton3Click(Sender: TObject); begin table_cancel(t_code_city); end; procedure Tfrm_code_city.bsSkinButton2Click(Sender: TObject); begin table_post(t_code_city); end; procedure Tfrm_code_city.bsSkinButton4Click(Sender: TObject); begin table_delete(t_code_city); end; procedure Tfrm_code_city.bsSkinButton1Click(Sender: TObject); begin t_code_city.Insert; end; procedure Tfrm_code_city.t_code_cityBeforePost(DataSet: TDataSet); begin table_before_post(t_code_city,'市区代码'); table_before_post(t_code_city,'市区'); table_before_post(t_code_city,'邮编'); end; procedure Tfrm_code_city.bsSkinSpeedButton1Click(Sender: TObject); begin with t_code_city do begin Close;sql.Clear; sql.Add('select * from t_code_city where 1=1 '); if edit1.text<>'' then SQL.Add(' and 市区代码 like ''%'+edit1.text+'%'''); if edit3.text<>'' then SQL.Add(' and 市区 like ''%'+edit3.text+'%'''); open; end; end; procedure Tfrm_code_city.Edit1KeyPress(Sender: TObject; var Key: Char); begin if Key=#13 then bsSkinSpeedButton1.OnClick(Sender); end; procedure Tfrm_code_city.t_code_cityNewRecord(DataSet: TDataSet); begin t_code_city.FieldByName('省份代码').AsString:='01'; end; end.