14 个解决方案
#1
看一下代码
#2
注意读写的时候,不可以写空字符串,具体看代码才知道
#3
可能是关键字的问题吧
#4
这样问?
看看你的代码
看看你的代码
#5
邏輯錯誤,只有看你的代碼?
#6
代码???
#7
没有说清楚对不起帮不上忙。
#8
代码1
unit edit;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, DB, ADODB, Grids, DBGrids, StdCtrls, Mask, DBCtrls, data_edit,
print;
type
Tw_edit = class(TForm)
DataSource1: TDataSource;
ADOQuery1: TADOQuery;
DB_number: TDBEdit;
DB_name: TDBEdit;
DB_fddbr: TDBEdit;
DBGrid1: TDBGrid;
DB_inc: TDBEdit;
DB_year: TDBEdit;
DB_zjmh: TDBEdit;
DB_dz: TDBEdit;
DB_tel: TDBEdit;
DB_cphm: TDBEdit;
DB_cjd: TDBEdit;
DB_time: TDBEdit;
DB_fadd: TDBEdit;
cb_edit: TButton;
DB_bary1: TDBEdit;
GroupBox1: TGroupBox;
Label3: TLabel;
Label1: TLabel;
Label2: TLabel;
Label4: TLabel;
Label5: TLabel;
GroupBox2: TGroupBox;
Label6: TLabel;
Label7: TLabel;
Label8: TLabel;
GroupBox3: TGroupBox;
Label9: TLabel;
Label10: TLabel;
Label11: TLabel;
Label12: TLabel;
Label13: TLabel;
Label14: TLabel;
Label15: TLabel;
Label16: TLabel;
Label17: TLabel;
Label18: TLabel;
DB_sex: TDBEdit;
DB_cx: TDBEdit;
DB_clyj: TDBEdit;
DB_cfcx: TDBEdit;
DB_zxjg: TDBEdit;
DB_dcjg: TDBEdit;
Label19: TLabel;
cd_new: TButton;
cb_del: TButton;
cb_exit: TButton;
cb_first: TButton;
cb_prior: TButton;
cb_next: TButton;
cb_last: TButton;
cb_print: TButton;
DB_bary2: TDBEdit;
procedure FormCreate(Sender: TObject);
procedure cb_editClick(Sender: TObject);
procedure DBGrid1DblClick(Sender: TObject);
procedure DBGrid1DrawColumnCell(Sender: TObject; const Rect: TRect;
DataCol: Integer; Column: TColumn; State: TGridDrawState);
procedure DBGrid1DrawDataCell(Sender: TObject; const Rect: TRect;
Field: TField; State: TGridDrawState);
procedure cd_newClick(Sender: TObject);
procedure cb_delClick(Sender: TObject);
procedure cb_exitClick(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
private
{ Private declarations }
public
{ Public declarations }
end;
type
TLaw=record
i_number:integer;
s_name:string;
s_inc:string;
s_fddbr:string;
s_sex:string;
i_year:integer;
s_zjmh:string;
s_dz:string;
s_tel:string;
s_cphm:string;
s_cx:string;
s_cjd:string;
s_time:string;
s_fadd:string;
s_bary1:string;
s_bary2:string;
s_dcjg:string;
s_clyj:string;
s_cfcx:string;
s_zxjg:string;
end;
var
w_edit: Tw_edit;
str_law:TLaw;
implementation
{$R *.dfm}
procedure Tw_edit.FormCreate(Sender: TObject);
begin
end;
procedure Tw_edit.cb_editClick(Sender: TObject);
begin
str_law.i_number :=ADOQuery1['案号'];
str_law.s_name:=ADOQuery1['公民'];
str_law.s_inc:=ADOQuery1['单位名称'];
str_law.s_fddbr:=ADOQuery1['法定代表人'];
str_law.s_sex:=ADOQuery1['性别'];
str_law.i_year:=ADOQuery1['年龄'];
str_law.s_zjmh:=ADOQuery1['证件名号'];
str_law.s_dz:=ADOQuery1['地址'];
str_law.s_tel:=ADOQuery1['电话'];
str_law.s_cphm :=ADOQuery1['牌(证)号'];
str_law.s_cx :=ADOQuery1['车型'];
str_law.s_cjd:=ADOQuery1['车籍地'];
str_law.s_time:=ADOQuery1['发案时间'];
str_law.s_fadd:=ADOQuery1['发案地点'];
str_law.s_bary1:=ADOQuery1['办案人员一'];
str_law.s_bary2:=ADOQuery1['办案人员二'];
str_law.s_dcjg:=ADOQuery1['调查经过'];
str_law.s_clyj:=ADOQuery1['处理意见'];
str_law.s_cfcx:=ADOQuery1['处罚程序'];
str_law.s_zxjg:=ADOQuery1['执行结果'];
//showmessage(inttostr(str_law.i_number)+str_law.s_cphm+str_law.s_cx+str_law.s_time);
ADOQuery1.Edit;
w_date_edit.ShowModal;
end;
procedure Tw_edit.DBGrid1DblClick(Sender: TObject);
begin
cb_edit.Click;
end;
procedure Tw_edit.DBGrid1DrawColumnCell(Sender: TObject; const Rect: TRect;
DataCol: Integer; Column: TColumn; State: TGridDrawState);
begin
if gdSelected in State then
begin
//DBGrid1.Canvas.Brush.Color:=RGB(120,120,120);
//DBGrid1.DefaultDrawColumnCell(Rect,DataCol,Column,State);
//DBGrid1.Canvas.Font.Color:=rgb(0,0,0);
Exit;
end;
if ADOQuery1.RecNo mod 2=0 then
DBGrid1.Canvas.Brush.Color:=rgb(255,255,255)//RGB(204,236,255)
else
DBGrid1.Canvas.Brush.Color:=RGB(238,238,238);
DBGrid1.DefaultDrawColumnCell(Rect,DataCol,Column,State);
//DBGrid1.Canvas.Pen.Color:=$00C08000;
//DBGrid1.Canvas.MoveTo(Rect.Left,Rect.Bottom);
//DBGrid1.Canvas.LineTo(Rect.Right,Rect.Bottom);
//DBGrid1.Canvas.MoveTo(Rect.Right,Rect.Top);
//DBGrid1.Canvas.LineTo(Rect.Right,Rect.Bottom);
end;
procedure Tw_edit.DBGrid1DrawDataCell(Sender: TObject; const Rect: TRect;
Field: TField; State: TGridDrawState);
begin
{with DBGrid1.Canvas do
begin
pen.Color:=clblue;
moveto(rect.Left,rect.Bottom);
lineto(rect.Right,rect.Bottom);
pen.Color:=clGreen;
moveto(rect.Right,rect.Top);
lineto(rect.Right,rect.Bottom);
end;}
end;
procedure Tw_edit.cd_newClick(Sender: TObject);
begin
//str_law.i_number :=ADOQuery1['案号'];
str_law.s_name:='';
str_law.s_inc:='';
str_law.s_fddbr:='';
str_law.s_sex:='';
str_law.i_year:=0;
str_law.s_zjmh:='';
str_law.s_dz:='';
str_law.s_tel:='';
str_law.s_cphm :='';
str_law.s_cx :='';
str_law.s_cjd:='';
str_law.s_time:='';
str_law.s_fadd:='';
str_law.s_bary1:='';
str_law.s_bary2:='';
str_law.s_dcjg:='';
str_law.s_clyj:='';
str_law.s_cfcx:='';
str_law.s_zxjg:='';
ADOQuery1.Insert;
w_date_edit.ShowModal;
end;
procedure Tw_edit.cb_delClick(Sender: TObject);
begin
if not adoquery1.Eof then
begin
if application.MessageBox('确定删除当前记录?','提示',MB_YESNO+MB_ICONQUESTION)=IDYES then
ADOQuery1.Delete;
ADOQuery1.Active:=false;
ADOQuery1.Active:=true;
end;
end;
procedure Tw_edit.cb_exitClick(Sender: TObject);
begin
close;
end;
procedure Tw_edit.FormClose(Sender: TObject; var Action: TCloseAction);
begin
action:=cafree;
//showmessage('');
end;
unit edit;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, DB, ADODB, Grids, DBGrids, StdCtrls, Mask, DBCtrls, data_edit,
print;
type
Tw_edit = class(TForm)
DataSource1: TDataSource;
ADOQuery1: TADOQuery;
DB_number: TDBEdit;
DB_name: TDBEdit;
DB_fddbr: TDBEdit;
DBGrid1: TDBGrid;
DB_inc: TDBEdit;
DB_year: TDBEdit;
DB_zjmh: TDBEdit;
DB_dz: TDBEdit;
DB_tel: TDBEdit;
DB_cphm: TDBEdit;
DB_cjd: TDBEdit;
DB_time: TDBEdit;
DB_fadd: TDBEdit;
cb_edit: TButton;
DB_bary1: TDBEdit;
GroupBox1: TGroupBox;
Label3: TLabel;
Label1: TLabel;
Label2: TLabel;
Label4: TLabel;
Label5: TLabel;
GroupBox2: TGroupBox;
Label6: TLabel;
Label7: TLabel;
Label8: TLabel;
GroupBox3: TGroupBox;
Label9: TLabel;
Label10: TLabel;
Label11: TLabel;
Label12: TLabel;
Label13: TLabel;
Label14: TLabel;
Label15: TLabel;
Label16: TLabel;
Label17: TLabel;
Label18: TLabel;
DB_sex: TDBEdit;
DB_cx: TDBEdit;
DB_clyj: TDBEdit;
DB_cfcx: TDBEdit;
DB_zxjg: TDBEdit;
DB_dcjg: TDBEdit;
Label19: TLabel;
cd_new: TButton;
cb_del: TButton;
cb_exit: TButton;
cb_first: TButton;
cb_prior: TButton;
cb_next: TButton;
cb_last: TButton;
cb_print: TButton;
DB_bary2: TDBEdit;
procedure FormCreate(Sender: TObject);
procedure cb_editClick(Sender: TObject);
procedure DBGrid1DblClick(Sender: TObject);
procedure DBGrid1DrawColumnCell(Sender: TObject; const Rect: TRect;
DataCol: Integer; Column: TColumn; State: TGridDrawState);
procedure DBGrid1DrawDataCell(Sender: TObject; const Rect: TRect;
Field: TField; State: TGridDrawState);
procedure cd_newClick(Sender: TObject);
procedure cb_delClick(Sender: TObject);
procedure cb_exitClick(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
private
{ Private declarations }
public
{ Public declarations }
end;
type
TLaw=record
i_number:integer;
s_name:string;
s_inc:string;
s_fddbr:string;
s_sex:string;
i_year:integer;
s_zjmh:string;
s_dz:string;
s_tel:string;
s_cphm:string;
s_cx:string;
s_cjd:string;
s_time:string;
s_fadd:string;
s_bary1:string;
s_bary2:string;
s_dcjg:string;
s_clyj:string;
s_cfcx:string;
s_zxjg:string;
end;
var
w_edit: Tw_edit;
str_law:TLaw;
implementation
{$R *.dfm}
procedure Tw_edit.FormCreate(Sender: TObject);
begin
end;
procedure Tw_edit.cb_editClick(Sender: TObject);
begin
str_law.i_number :=ADOQuery1['案号'];
str_law.s_name:=ADOQuery1['公民'];
str_law.s_inc:=ADOQuery1['单位名称'];
str_law.s_fddbr:=ADOQuery1['法定代表人'];
str_law.s_sex:=ADOQuery1['性别'];
str_law.i_year:=ADOQuery1['年龄'];
str_law.s_zjmh:=ADOQuery1['证件名号'];
str_law.s_dz:=ADOQuery1['地址'];
str_law.s_tel:=ADOQuery1['电话'];
str_law.s_cphm :=ADOQuery1['牌(证)号'];
str_law.s_cx :=ADOQuery1['车型'];
str_law.s_cjd:=ADOQuery1['车籍地'];
str_law.s_time:=ADOQuery1['发案时间'];
str_law.s_fadd:=ADOQuery1['发案地点'];
str_law.s_bary1:=ADOQuery1['办案人员一'];
str_law.s_bary2:=ADOQuery1['办案人员二'];
str_law.s_dcjg:=ADOQuery1['调查经过'];
str_law.s_clyj:=ADOQuery1['处理意见'];
str_law.s_cfcx:=ADOQuery1['处罚程序'];
str_law.s_zxjg:=ADOQuery1['执行结果'];
//showmessage(inttostr(str_law.i_number)+str_law.s_cphm+str_law.s_cx+str_law.s_time);
ADOQuery1.Edit;
w_date_edit.ShowModal;
end;
procedure Tw_edit.DBGrid1DblClick(Sender: TObject);
begin
cb_edit.Click;
end;
procedure Tw_edit.DBGrid1DrawColumnCell(Sender: TObject; const Rect: TRect;
DataCol: Integer; Column: TColumn; State: TGridDrawState);
begin
if gdSelected in State then
begin
//DBGrid1.Canvas.Brush.Color:=RGB(120,120,120);
//DBGrid1.DefaultDrawColumnCell(Rect,DataCol,Column,State);
//DBGrid1.Canvas.Font.Color:=rgb(0,0,0);
Exit;
end;
if ADOQuery1.RecNo mod 2=0 then
DBGrid1.Canvas.Brush.Color:=rgb(255,255,255)//RGB(204,236,255)
else
DBGrid1.Canvas.Brush.Color:=RGB(238,238,238);
DBGrid1.DefaultDrawColumnCell(Rect,DataCol,Column,State);
//DBGrid1.Canvas.Pen.Color:=$00C08000;
//DBGrid1.Canvas.MoveTo(Rect.Left,Rect.Bottom);
//DBGrid1.Canvas.LineTo(Rect.Right,Rect.Bottom);
//DBGrid1.Canvas.MoveTo(Rect.Right,Rect.Top);
//DBGrid1.Canvas.LineTo(Rect.Right,Rect.Bottom);
end;
procedure Tw_edit.DBGrid1DrawDataCell(Sender: TObject; const Rect: TRect;
Field: TField; State: TGridDrawState);
begin
{with DBGrid1.Canvas do
begin
pen.Color:=clblue;
moveto(rect.Left,rect.Bottom);
lineto(rect.Right,rect.Bottom);
pen.Color:=clGreen;
moveto(rect.Right,rect.Top);
lineto(rect.Right,rect.Bottom);
end;}
end;
procedure Tw_edit.cd_newClick(Sender: TObject);
begin
//str_law.i_number :=ADOQuery1['案号'];
str_law.s_name:='';
str_law.s_inc:='';
str_law.s_fddbr:='';
str_law.s_sex:='';
str_law.i_year:=0;
str_law.s_zjmh:='';
str_law.s_dz:='';
str_law.s_tel:='';
str_law.s_cphm :='';
str_law.s_cx :='';
str_law.s_cjd:='';
str_law.s_time:='';
str_law.s_fadd:='';
str_law.s_bary1:='';
str_law.s_bary2:='';
str_law.s_dcjg:='';
str_law.s_clyj:='';
str_law.s_cfcx:='';
str_law.s_zxjg:='';
ADOQuery1.Insert;
w_date_edit.ShowModal;
end;
procedure Tw_edit.cb_delClick(Sender: TObject);
begin
if not adoquery1.Eof then
begin
if application.MessageBox('确定删除当前记录?','提示',MB_YESNO+MB_ICONQUESTION)=IDYES then
ADOQuery1.Delete;
ADOQuery1.Active:=false;
ADOQuery1.Active:=true;
end;
end;
procedure Tw_edit.cb_exitClick(Sender: TObject);
begin
close;
end;
procedure Tw_edit.FormClose(Sender: TObject; var Action: TCloseAction);
begin
action:=cafree;
//showmessage('');
end;
#9
代码二
unit data_edit;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, DB, ADODB;
type
Tw_date_edit = class(TForm)
Edit_number: TEdit;
Edit_name: TEdit;
Edit_year: TEdit;
Edit_dz: TEdit;
Edit_zjmh: TEdit;
GroupBox1: TGroupBox;
Edit_inc: TEdit;
Edit_fddbr: TEdit;
Edit_tel: TEdit;
GroupBox2: TGroupBox;
Edit_cphm: TEdit;
ComboBox_cx: TComboBox;
Edit_cjd: TEdit;
Edit_time: TEdit;
Edit_fadz: TEdit;
ComboBox_clyj: TComboBox;
ComboBox_cfcx: TComboBox;
ComboBox_zxjg: TComboBox;
ComboBox_sex: TComboBox;
GroupBox3: TGroupBox;
cb_ok: TButton;
Edit_bary1: TEdit;
cb_close: TButton;
Edit_dcjg: TEdit;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
Label5: TLabel;
Label6: TLabel;
Label7: TLabel;
Label8: TLabel;
Label9: TLabel;
Label10: TLabel;
Label11: TLabel;
Label12: TLabel;
Label13: TLabel;
Label14: TLabel;
Label15: TLabel;
Label16: TLabel;
Label17: TLabel;
Label18: TLabel;
Label19: TLabel;
ADOQuery_fg: TADOQuery;
Edit_bary2: TEdit;
procedure FormCreate(Sender: TObject);
procedure cb_okClick(Sender: TObject);
procedure FormActivate(Sender: TObject);
procedure cb_closeClick(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
w_date_edit: Tw_date_edit;
implementation
uses edit;
{$R *.dfm}
procedure Tw_date_edit.FormCreate(Sender: TObject);
begin
//listbox_bary.Items.Add('李柏洪');
//listbox_bary.Items.Add('王红勤');
combobox_sex.Items.Add('男');
combobox_sex.Items.Add('女');
combobox_cx.Items.Add('大货');
combobox_cx.Items.Add('小货');
combobox_cx.Items.Add('大客');
combobox_cx.Items.Add('小客');
combobox_cx.Items.Add('轿车');
combobox_cx.Items.Add('其它');
ADOQuery_fg.Open;
ADOQuery_fg.First;
while not ADOQuery_fg.Eof do
begin
combobox_clyj.Items.Add(adoquery_fg['法规']);
adoquery_fg.Next;
end;
ADOQuery_fg.Close;
end;
procedure Tw_date_edit.cb_okClick(Sender: TObject);
begin
//edit.w_edit.ADOQuery1.Edit;
edit.w_edit.ADOQuery1['公民']:=edit_name.Text;
edit.w_edit.ADOQuery1['性别']:=combobox_sex.Text;
edit.w_edit.ADOQuery1['年龄']:=strtoint(edit_year.Text);
edit.w_edit.ADOQuery1['证件名号']:=edit_zjmh.Text;
edit.w_edit.ADOQuery1['地址']:=edit_dz.Text;
edit.w_edit.ADOQuery1['单位名称']:=edit_inc.Text;
edit.w_edit.ADOQuery1['法定代表人']:=edit_fddbr.Text;
edit.w_edit.ADOQuery1['电话']:=edit_tel.Text;
edit.w_edit.ADOQuery1['案号']:=strtoint(edit_number.Text);
edit.w_edit.ADOQuery1['牌(证)号']:=edit_cphm.Text;
edit.w_edit.ADOQuery1['车型']:=combobox_cx.Text;
edit.w_edit.ADOQuery1['车籍地']:=edit_cjd.Text;
edit.w_edit.ADOQuery1['发案时间']:=edit_time.Text;
edit.w_edit.ADOQuery1['发案地点']:=edit_fadz.Text;
edit.w_edit.ADOQuery1['调查经过']:=edit_dcjg.Text;
edit.w_edit.ADOQuery1['处理意见']:=combobox_clyj.Text;
edit.w_edit.ADOQuery1['处罚程序']:=combobox_cfcx.Text;
edit.w_edit.ADOQuery1['执行结果']:=combobox_zxjg.Text;
edit.w_edit.ADOQuery1['办案人员一']:=edit_bary1.Text;
edit.w_edit.ADOQuery1['办案人员二']:=edit_bary2.Text;
edit.w_edit.ADOQuery1.Post;
edit.w_edit.ADOQuery1.Active:=false;
edit.w_edit.ADOQuery1.Active:=true;
close;
//showmessage(inttostr(str_law.i_number)+str_law.s_cphm+str_law.s_cx+str_law.s_time);
end;
procedure Tw_date_edit.FormActivate(Sender: TObject);
begin
edit_name.Text:=edit.str_law.s_name;
combobox_sex.Text:=edit.str_law.s_sex;
edit_year.Text:=inttostr(edit.str_law.i_year);
edit_zjmh.Text:=edit.str_law.s_zjmh;
edit_dz.Text:=edit.str_law.s_dz;
edit_inc.Text:=edit.str_law.s_inc;
edit_fddbr.Text:=edit.str_law.s_fddbr;
edit_tel.Text:=edit.str_law.s_tel;
edit_number.Text:= inttostr(edit.str_law.i_number);
edit_cphm.Text:=edit.str_law.s_cphm;
combobox_cx.Text:=edit.str_law.s_cx;
edit_cjd.Text:=edit.str_law.s_cjd;
edit_time.Text:=edit.str_law.s_time;
edit_fadz.Text:=edit.str_law.s_fadd;
edit_dcjg.Text:=edit.str_law.s_dcjg;
combobox_clyj.Text:=edit.str_law.s_clyj;
combobox_cfcx.Text:=edit.str_law.s_cfcx;
combobox_zxjg.Text:=edit.str_law.s_zxjg;
edit_bary1.Text:=edit.str_law.s_bary1;
edit_bary2.Text:=edit.str_law.s_bary2;
end;
procedure Tw_date_edit.cb_closeClick(Sender: TObject);
begin
close;
end;
end.
unit data_edit;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, DB, ADODB;
type
Tw_date_edit = class(TForm)
Edit_number: TEdit;
Edit_name: TEdit;
Edit_year: TEdit;
Edit_dz: TEdit;
Edit_zjmh: TEdit;
GroupBox1: TGroupBox;
Edit_inc: TEdit;
Edit_fddbr: TEdit;
Edit_tel: TEdit;
GroupBox2: TGroupBox;
Edit_cphm: TEdit;
ComboBox_cx: TComboBox;
Edit_cjd: TEdit;
Edit_time: TEdit;
Edit_fadz: TEdit;
ComboBox_clyj: TComboBox;
ComboBox_cfcx: TComboBox;
ComboBox_zxjg: TComboBox;
ComboBox_sex: TComboBox;
GroupBox3: TGroupBox;
cb_ok: TButton;
Edit_bary1: TEdit;
cb_close: TButton;
Edit_dcjg: TEdit;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
Label5: TLabel;
Label6: TLabel;
Label7: TLabel;
Label8: TLabel;
Label9: TLabel;
Label10: TLabel;
Label11: TLabel;
Label12: TLabel;
Label13: TLabel;
Label14: TLabel;
Label15: TLabel;
Label16: TLabel;
Label17: TLabel;
Label18: TLabel;
Label19: TLabel;
ADOQuery_fg: TADOQuery;
Edit_bary2: TEdit;
procedure FormCreate(Sender: TObject);
procedure cb_okClick(Sender: TObject);
procedure FormActivate(Sender: TObject);
procedure cb_closeClick(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
w_date_edit: Tw_date_edit;
implementation
uses edit;
{$R *.dfm}
procedure Tw_date_edit.FormCreate(Sender: TObject);
begin
//listbox_bary.Items.Add('李柏洪');
//listbox_bary.Items.Add('王红勤');
combobox_sex.Items.Add('男');
combobox_sex.Items.Add('女');
combobox_cx.Items.Add('大货');
combobox_cx.Items.Add('小货');
combobox_cx.Items.Add('大客');
combobox_cx.Items.Add('小客');
combobox_cx.Items.Add('轿车');
combobox_cx.Items.Add('其它');
ADOQuery_fg.Open;
ADOQuery_fg.First;
while not ADOQuery_fg.Eof do
begin
combobox_clyj.Items.Add(adoquery_fg['法规']);
adoquery_fg.Next;
end;
ADOQuery_fg.Close;
end;
procedure Tw_date_edit.cb_okClick(Sender: TObject);
begin
//edit.w_edit.ADOQuery1.Edit;
edit.w_edit.ADOQuery1['公民']:=edit_name.Text;
edit.w_edit.ADOQuery1['性别']:=combobox_sex.Text;
edit.w_edit.ADOQuery1['年龄']:=strtoint(edit_year.Text);
edit.w_edit.ADOQuery1['证件名号']:=edit_zjmh.Text;
edit.w_edit.ADOQuery1['地址']:=edit_dz.Text;
edit.w_edit.ADOQuery1['单位名称']:=edit_inc.Text;
edit.w_edit.ADOQuery1['法定代表人']:=edit_fddbr.Text;
edit.w_edit.ADOQuery1['电话']:=edit_tel.Text;
edit.w_edit.ADOQuery1['案号']:=strtoint(edit_number.Text);
edit.w_edit.ADOQuery1['牌(证)号']:=edit_cphm.Text;
edit.w_edit.ADOQuery1['车型']:=combobox_cx.Text;
edit.w_edit.ADOQuery1['车籍地']:=edit_cjd.Text;
edit.w_edit.ADOQuery1['发案时间']:=edit_time.Text;
edit.w_edit.ADOQuery1['发案地点']:=edit_fadz.Text;
edit.w_edit.ADOQuery1['调查经过']:=edit_dcjg.Text;
edit.w_edit.ADOQuery1['处理意见']:=combobox_clyj.Text;
edit.w_edit.ADOQuery1['处罚程序']:=combobox_cfcx.Text;
edit.w_edit.ADOQuery1['执行结果']:=combobox_zxjg.Text;
edit.w_edit.ADOQuery1['办案人员一']:=edit_bary1.Text;
edit.w_edit.ADOQuery1['办案人员二']:=edit_bary2.Text;
edit.w_edit.ADOQuery1.Post;
edit.w_edit.ADOQuery1.Active:=false;
edit.w_edit.ADOQuery1.Active:=true;
close;
//showmessage(inttostr(str_law.i_number)+str_law.s_cphm+str_law.s_cx+str_law.s_time);
end;
procedure Tw_date_edit.FormActivate(Sender: TObject);
begin
edit_name.Text:=edit.str_law.s_name;
combobox_sex.Text:=edit.str_law.s_sex;
edit_year.Text:=inttostr(edit.str_law.i_year);
edit_zjmh.Text:=edit.str_law.s_zjmh;
edit_dz.Text:=edit.str_law.s_dz;
edit_inc.Text:=edit.str_law.s_inc;
edit_fddbr.Text:=edit.str_law.s_fddbr;
edit_tel.Text:=edit.str_law.s_tel;
edit_number.Text:= inttostr(edit.str_law.i_number);
edit_cphm.Text:=edit.str_law.s_cphm;
combobox_cx.Text:=edit.str_law.s_cx;
edit_cjd.Text:=edit.str_law.s_cjd;
edit_time.Text:=edit.str_law.s_time;
edit_fadz.Text:=edit.str_law.s_fadd;
edit_dcjg.Text:=edit.str_law.s_dcjg;
combobox_clyj.Text:=edit.str_law.s_clyj;
combobox_cfcx.Text:=edit.str_law.s_cfcx;
combobox_zxjg.Text:=edit.str_law.s_zxjg;
edit_bary1.Text:=edit.str_law.s_bary1;
edit_bary2.Text:=edit.str_law.s_bary2;
end;
procedure Tw_date_edit.cb_closeClick(Sender: TObject);
begin
close;
end;
end.
#10
帮帮我啊,分不够,可以再加啊,谢谢啊
#11
你应该将所报的错误,详细地写出来
#12
把错误的行和错误信息写出来就好了,不用全写出来啊。这样看多慢啊。
#13
就是,把错误信息给出来吧
#14
编译通过,没有错误代码,但一有对数据表的操作(比如ADOQUERY1.EDIT...),就弹出错误对话框,乱七八糟的。
#1
看一下代码
#2
注意读写的时候,不可以写空字符串,具体看代码才知道
#3
可能是关键字的问题吧
#4
这样问?
看看你的代码
看看你的代码
#5
邏輯錯誤,只有看你的代碼?
#6
代码???
#7
没有说清楚对不起帮不上忙。
#8
代码1
unit edit;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, DB, ADODB, Grids, DBGrids, StdCtrls, Mask, DBCtrls, data_edit,
print;
type
Tw_edit = class(TForm)
DataSource1: TDataSource;
ADOQuery1: TADOQuery;
DB_number: TDBEdit;
DB_name: TDBEdit;
DB_fddbr: TDBEdit;
DBGrid1: TDBGrid;
DB_inc: TDBEdit;
DB_year: TDBEdit;
DB_zjmh: TDBEdit;
DB_dz: TDBEdit;
DB_tel: TDBEdit;
DB_cphm: TDBEdit;
DB_cjd: TDBEdit;
DB_time: TDBEdit;
DB_fadd: TDBEdit;
cb_edit: TButton;
DB_bary1: TDBEdit;
GroupBox1: TGroupBox;
Label3: TLabel;
Label1: TLabel;
Label2: TLabel;
Label4: TLabel;
Label5: TLabel;
GroupBox2: TGroupBox;
Label6: TLabel;
Label7: TLabel;
Label8: TLabel;
GroupBox3: TGroupBox;
Label9: TLabel;
Label10: TLabel;
Label11: TLabel;
Label12: TLabel;
Label13: TLabel;
Label14: TLabel;
Label15: TLabel;
Label16: TLabel;
Label17: TLabel;
Label18: TLabel;
DB_sex: TDBEdit;
DB_cx: TDBEdit;
DB_clyj: TDBEdit;
DB_cfcx: TDBEdit;
DB_zxjg: TDBEdit;
DB_dcjg: TDBEdit;
Label19: TLabel;
cd_new: TButton;
cb_del: TButton;
cb_exit: TButton;
cb_first: TButton;
cb_prior: TButton;
cb_next: TButton;
cb_last: TButton;
cb_print: TButton;
DB_bary2: TDBEdit;
procedure FormCreate(Sender: TObject);
procedure cb_editClick(Sender: TObject);
procedure DBGrid1DblClick(Sender: TObject);
procedure DBGrid1DrawColumnCell(Sender: TObject; const Rect: TRect;
DataCol: Integer; Column: TColumn; State: TGridDrawState);
procedure DBGrid1DrawDataCell(Sender: TObject; const Rect: TRect;
Field: TField; State: TGridDrawState);
procedure cd_newClick(Sender: TObject);
procedure cb_delClick(Sender: TObject);
procedure cb_exitClick(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
private
{ Private declarations }
public
{ Public declarations }
end;
type
TLaw=record
i_number:integer;
s_name:string;
s_inc:string;
s_fddbr:string;
s_sex:string;
i_year:integer;
s_zjmh:string;
s_dz:string;
s_tel:string;
s_cphm:string;
s_cx:string;
s_cjd:string;
s_time:string;
s_fadd:string;
s_bary1:string;
s_bary2:string;
s_dcjg:string;
s_clyj:string;
s_cfcx:string;
s_zxjg:string;
end;
var
w_edit: Tw_edit;
str_law:TLaw;
implementation
{$R *.dfm}
procedure Tw_edit.FormCreate(Sender: TObject);
begin
end;
procedure Tw_edit.cb_editClick(Sender: TObject);
begin
str_law.i_number :=ADOQuery1['案号'];
str_law.s_name:=ADOQuery1['公民'];
str_law.s_inc:=ADOQuery1['单位名称'];
str_law.s_fddbr:=ADOQuery1['法定代表人'];
str_law.s_sex:=ADOQuery1['性别'];
str_law.i_year:=ADOQuery1['年龄'];
str_law.s_zjmh:=ADOQuery1['证件名号'];
str_law.s_dz:=ADOQuery1['地址'];
str_law.s_tel:=ADOQuery1['电话'];
str_law.s_cphm :=ADOQuery1['牌(证)号'];
str_law.s_cx :=ADOQuery1['车型'];
str_law.s_cjd:=ADOQuery1['车籍地'];
str_law.s_time:=ADOQuery1['发案时间'];
str_law.s_fadd:=ADOQuery1['发案地点'];
str_law.s_bary1:=ADOQuery1['办案人员一'];
str_law.s_bary2:=ADOQuery1['办案人员二'];
str_law.s_dcjg:=ADOQuery1['调查经过'];
str_law.s_clyj:=ADOQuery1['处理意见'];
str_law.s_cfcx:=ADOQuery1['处罚程序'];
str_law.s_zxjg:=ADOQuery1['执行结果'];
//showmessage(inttostr(str_law.i_number)+str_law.s_cphm+str_law.s_cx+str_law.s_time);
ADOQuery1.Edit;
w_date_edit.ShowModal;
end;
procedure Tw_edit.DBGrid1DblClick(Sender: TObject);
begin
cb_edit.Click;
end;
procedure Tw_edit.DBGrid1DrawColumnCell(Sender: TObject; const Rect: TRect;
DataCol: Integer; Column: TColumn; State: TGridDrawState);
begin
if gdSelected in State then
begin
//DBGrid1.Canvas.Brush.Color:=RGB(120,120,120);
//DBGrid1.DefaultDrawColumnCell(Rect,DataCol,Column,State);
//DBGrid1.Canvas.Font.Color:=rgb(0,0,0);
Exit;
end;
if ADOQuery1.RecNo mod 2=0 then
DBGrid1.Canvas.Brush.Color:=rgb(255,255,255)//RGB(204,236,255)
else
DBGrid1.Canvas.Brush.Color:=RGB(238,238,238);
DBGrid1.DefaultDrawColumnCell(Rect,DataCol,Column,State);
//DBGrid1.Canvas.Pen.Color:=$00C08000;
//DBGrid1.Canvas.MoveTo(Rect.Left,Rect.Bottom);
//DBGrid1.Canvas.LineTo(Rect.Right,Rect.Bottom);
//DBGrid1.Canvas.MoveTo(Rect.Right,Rect.Top);
//DBGrid1.Canvas.LineTo(Rect.Right,Rect.Bottom);
end;
procedure Tw_edit.DBGrid1DrawDataCell(Sender: TObject; const Rect: TRect;
Field: TField; State: TGridDrawState);
begin
{with DBGrid1.Canvas do
begin
pen.Color:=clblue;
moveto(rect.Left,rect.Bottom);
lineto(rect.Right,rect.Bottom);
pen.Color:=clGreen;
moveto(rect.Right,rect.Top);
lineto(rect.Right,rect.Bottom);
end;}
end;
procedure Tw_edit.cd_newClick(Sender: TObject);
begin
//str_law.i_number :=ADOQuery1['案号'];
str_law.s_name:='';
str_law.s_inc:='';
str_law.s_fddbr:='';
str_law.s_sex:='';
str_law.i_year:=0;
str_law.s_zjmh:='';
str_law.s_dz:='';
str_law.s_tel:='';
str_law.s_cphm :='';
str_law.s_cx :='';
str_law.s_cjd:='';
str_law.s_time:='';
str_law.s_fadd:='';
str_law.s_bary1:='';
str_law.s_bary2:='';
str_law.s_dcjg:='';
str_law.s_clyj:='';
str_law.s_cfcx:='';
str_law.s_zxjg:='';
ADOQuery1.Insert;
w_date_edit.ShowModal;
end;
procedure Tw_edit.cb_delClick(Sender: TObject);
begin
if not adoquery1.Eof then
begin
if application.MessageBox('确定删除当前记录?','提示',MB_YESNO+MB_ICONQUESTION)=IDYES then
ADOQuery1.Delete;
ADOQuery1.Active:=false;
ADOQuery1.Active:=true;
end;
end;
procedure Tw_edit.cb_exitClick(Sender: TObject);
begin
close;
end;
procedure Tw_edit.FormClose(Sender: TObject; var Action: TCloseAction);
begin
action:=cafree;
//showmessage('');
end;
unit edit;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, DB, ADODB, Grids, DBGrids, StdCtrls, Mask, DBCtrls, data_edit,
print;
type
Tw_edit = class(TForm)
DataSource1: TDataSource;
ADOQuery1: TADOQuery;
DB_number: TDBEdit;
DB_name: TDBEdit;
DB_fddbr: TDBEdit;
DBGrid1: TDBGrid;
DB_inc: TDBEdit;
DB_year: TDBEdit;
DB_zjmh: TDBEdit;
DB_dz: TDBEdit;
DB_tel: TDBEdit;
DB_cphm: TDBEdit;
DB_cjd: TDBEdit;
DB_time: TDBEdit;
DB_fadd: TDBEdit;
cb_edit: TButton;
DB_bary1: TDBEdit;
GroupBox1: TGroupBox;
Label3: TLabel;
Label1: TLabel;
Label2: TLabel;
Label4: TLabel;
Label5: TLabel;
GroupBox2: TGroupBox;
Label6: TLabel;
Label7: TLabel;
Label8: TLabel;
GroupBox3: TGroupBox;
Label9: TLabel;
Label10: TLabel;
Label11: TLabel;
Label12: TLabel;
Label13: TLabel;
Label14: TLabel;
Label15: TLabel;
Label16: TLabel;
Label17: TLabel;
Label18: TLabel;
DB_sex: TDBEdit;
DB_cx: TDBEdit;
DB_clyj: TDBEdit;
DB_cfcx: TDBEdit;
DB_zxjg: TDBEdit;
DB_dcjg: TDBEdit;
Label19: TLabel;
cd_new: TButton;
cb_del: TButton;
cb_exit: TButton;
cb_first: TButton;
cb_prior: TButton;
cb_next: TButton;
cb_last: TButton;
cb_print: TButton;
DB_bary2: TDBEdit;
procedure FormCreate(Sender: TObject);
procedure cb_editClick(Sender: TObject);
procedure DBGrid1DblClick(Sender: TObject);
procedure DBGrid1DrawColumnCell(Sender: TObject; const Rect: TRect;
DataCol: Integer; Column: TColumn; State: TGridDrawState);
procedure DBGrid1DrawDataCell(Sender: TObject; const Rect: TRect;
Field: TField; State: TGridDrawState);
procedure cd_newClick(Sender: TObject);
procedure cb_delClick(Sender: TObject);
procedure cb_exitClick(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
private
{ Private declarations }
public
{ Public declarations }
end;
type
TLaw=record
i_number:integer;
s_name:string;
s_inc:string;
s_fddbr:string;
s_sex:string;
i_year:integer;
s_zjmh:string;
s_dz:string;
s_tel:string;
s_cphm:string;
s_cx:string;
s_cjd:string;
s_time:string;
s_fadd:string;
s_bary1:string;
s_bary2:string;
s_dcjg:string;
s_clyj:string;
s_cfcx:string;
s_zxjg:string;
end;
var
w_edit: Tw_edit;
str_law:TLaw;
implementation
{$R *.dfm}
procedure Tw_edit.FormCreate(Sender: TObject);
begin
end;
procedure Tw_edit.cb_editClick(Sender: TObject);
begin
str_law.i_number :=ADOQuery1['案号'];
str_law.s_name:=ADOQuery1['公民'];
str_law.s_inc:=ADOQuery1['单位名称'];
str_law.s_fddbr:=ADOQuery1['法定代表人'];
str_law.s_sex:=ADOQuery1['性别'];
str_law.i_year:=ADOQuery1['年龄'];
str_law.s_zjmh:=ADOQuery1['证件名号'];
str_law.s_dz:=ADOQuery1['地址'];
str_law.s_tel:=ADOQuery1['电话'];
str_law.s_cphm :=ADOQuery1['牌(证)号'];
str_law.s_cx :=ADOQuery1['车型'];
str_law.s_cjd:=ADOQuery1['车籍地'];
str_law.s_time:=ADOQuery1['发案时间'];
str_law.s_fadd:=ADOQuery1['发案地点'];
str_law.s_bary1:=ADOQuery1['办案人员一'];
str_law.s_bary2:=ADOQuery1['办案人员二'];
str_law.s_dcjg:=ADOQuery1['调查经过'];
str_law.s_clyj:=ADOQuery1['处理意见'];
str_law.s_cfcx:=ADOQuery1['处罚程序'];
str_law.s_zxjg:=ADOQuery1['执行结果'];
//showmessage(inttostr(str_law.i_number)+str_law.s_cphm+str_law.s_cx+str_law.s_time);
ADOQuery1.Edit;
w_date_edit.ShowModal;
end;
procedure Tw_edit.DBGrid1DblClick(Sender: TObject);
begin
cb_edit.Click;
end;
procedure Tw_edit.DBGrid1DrawColumnCell(Sender: TObject; const Rect: TRect;
DataCol: Integer; Column: TColumn; State: TGridDrawState);
begin
if gdSelected in State then
begin
//DBGrid1.Canvas.Brush.Color:=RGB(120,120,120);
//DBGrid1.DefaultDrawColumnCell(Rect,DataCol,Column,State);
//DBGrid1.Canvas.Font.Color:=rgb(0,0,0);
Exit;
end;
if ADOQuery1.RecNo mod 2=0 then
DBGrid1.Canvas.Brush.Color:=rgb(255,255,255)//RGB(204,236,255)
else
DBGrid1.Canvas.Brush.Color:=RGB(238,238,238);
DBGrid1.DefaultDrawColumnCell(Rect,DataCol,Column,State);
//DBGrid1.Canvas.Pen.Color:=$00C08000;
//DBGrid1.Canvas.MoveTo(Rect.Left,Rect.Bottom);
//DBGrid1.Canvas.LineTo(Rect.Right,Rect.Bottom);
//DBGrid1.Canvas.MoveTo(Rect.Right,Rect.Top);
//DBGrid1.Canvas.LineTo(Rect.Right,Rect.Bottom);
end;
procedure Tw_edit.DBGrid1DrawDataCell(Sender: TObject; const Rect: TRect;
Field: TField; State: TGridDrawState);
begin
{with DBGrid1.Canvas do
begin
pen.Color:=clblue;
moveto(rect.Left,rect.Bottom);
lineto(rect.Right,rect.Bottom);
pen.Color:=clGreen;
moveto(rect.Right,rect.Top);
lineto(rect.Right,rect.Bottom);
end;}
end;
procedure Tw_edit.cd_newClick(Sender: TObject);
begin
//str_law.i_number :=ADOQuery1['案号'];
str_law.s_name:='';
str_law.s_inc:='';
str_law.s_fddbr:='';
str_law.s_sex:='';
str_law.i_year:=0;
str_law.s_zjmh:='';
str_law.s_dz:='';
str_law.s_tel:='';
str_law.s_cphm :='';
str_law.s_cx :='';
str_law.s_cjd:='';
str_law.s_time:='';
str_law.s_fadd:='';
str_law.s_bary1:='';
str_law.s_bary2:='';
str_law.s_dcjg:='';
str_law.s_clyj:='';
str_law.s_cfcx:='';
str_law.s_zxjg:='';
ADOQuery1.Insert;
w_date_edit.ShowModal;
end;
procedure Tw_edit.cb_delClick(Sender: TObject);
begin
if not adoquery1.Eof then
begin
if application.MessageBox('确定删除当前记录?','提示',MB_YESNO+MB_ICONQUESTION)=IDYES then
ADOQuery1.Delete;
ADOQuery1.Active:=false;
ADOQuery1.Active:=true;
end;
end;
procedure Tw_edit.cb_exitClick(Sender: TObject);
begin
close;
end;
procedure Tw_edit.FormClose(Sender: TObject; var Action: TCloseAction);
begin
action:=cafree;
//showmessage('');
end;
#9
代码二
unit data_edit;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, DB, ADODB;
type
Tw_date_edit = class(TForm)
Edit_number: TEdit;
Edit_name: TEdit;
Edit_year: TEdit;
Edit_dz: TEdit;
Edit_zjmh: TEdit;
GroupBox1: TGroupBox;
Edit_inc: TEdit;
Edit_fddbr: TEdit;
Edit_tel: TEdit;
GroupBox2: TGroupBox;
Edit_cphm: TEdit;
ComboBox_cx: TComboBox;
Edit_cjd: TEdit;
Edit_time: TEdit;
Edit_fadz: TEdit;
ComboBox_clyj: TComboBox;
ComboBox_cfcx: TComboBox;
ComboBox_zxjg: TComboBox;
ComboBox_sex: TComboBox;
GroupBox3: TGroupBox;
cb_ok: TButton;
Edit_bary1: TEdit;
cb_close: TButton;
Edit_dcjg: TEdit;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
Label5: TLabel;
Label6: TLabel;
Label7: TLabel;
Label8: TLabel;
Label9: TLabel;
Label10: TLabel;
Label11: TLabel;
Label12: TLabel;
Label13: TLabel;
Label14: TLabel;
Label15: TLabel;
Label16: TLabel;
Label17: TLabel;
Label18: TLabel;
Label19: TLabel;
ADOQuery_fg: TADOQuery;
Edit_bary2: TEdit;
procedure FormCreate(Sender: TObject);
procedure cb_okClick(Sender: TObject);
procedure FormActivate(Sender: TObject);
procedure cb_closeClick(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
w_date_edit: Tw_date_edit;
implementation
uses edit;
{$R *.dfm}
procedure Tw_date_edit.FormCreate(Sender: TObject);
begin
//listbox_bary.Items.Add('李柏洪');
//listbox_bary.Items.Add('王红勤');
combobox_sex.Items.Add('男');
combobox_sex.Items.Add('女');
combobox_cx.Items.Add('大货');
combobox_cx.Items.Add('小货');
combobox_cx.Items.Add('大客');
combobox_cx.Items.Add('小客');
combobox_cx.Items.Add('轿车');
combobox_cx.Items.Add('其它');
ADOQuery_fg.Open;
ADOQuery_fg.First;
while not ADOQuery_fg.Eof do
begin
combobox_clyj.Items.Add(adoquery_fg['法规']);
adoquery_fg.Next;
end;
ADOQuery_fg.Close;
end;
procedure Tw_date_edit.cb_okClick(Sender: TObject);
begin
//edit.w_edit.ADOQuery1.Edit;
edit.w_edit.ADOQuery1['公民']:=edit_name.Text;
edit.w_edit.ADOQuery1['性别']:=combobox_sex.Text;
edit.w_edit.ADOQuery1['年龄']:=strtoint(edit_year.Text);
edit.w_edit.ADOQuery1['证件名号']:=edit_zjmh.Text;
edit.w_edit.ADOQuery1['地址']:=edit_dz.Text;
edit.w_edit.ADOQuery1['单位名称']:=edit_inc.Text;
edit.w_edit.ADOQuery1['法定代表人']:=edit_fddbr.Text;
edit.w_edit.ADOQuery1['电话']:=edit_tel.Text;
edit.w_edit.ADOQuery1['案号']:=strtoint(edit_number.Text);
edit.w_edit.ADOQuery1['牌(证)号']:=edit_cphm.Text;
edit.w_edit.ADOQuery1['车型']:=combobox_cx.Text;
edit.w_edit.ADOQuery1['车籍地']:=edit_cjd.Text;
edit.w_edit.ADOQuery1['发案时间']:=edit_time.Text;
edit.w_edit.ADOQuery1['发案地点']:=edit_fadz.Text;
edit.w_edit.ADOQuery1['调查经过']:=edit_dcjg.Text;
edit.w_edit.ADOQuery1['处理意见']:=combobox_clyj.Text;
edit.w_edit.ADOQuery1['处罚程序']:=combobox_cfcx.Text;
edit.w_edit.ADOQuery1['执行结果']:=combobox_zxjg.Text;
edit.w_edit.ADOQuery1['办案人员一']:=edit_bary1.Text;
edit.w_edit.ADOQuery1['办案人员二']:=edit_bary2.Text;
edit.w_edit.ADOQuery1.Post;
edit.w_edit.ADOQuery1.Active:=false;
edit.w_edit.ADOQuery1.Active:=true;
close;
//showmessage(inttostr(str_law.i_number)+str_law.s_cphm+str_law.s_cx+str_law.s_time);
end;
procedure Tw_date_edit.FormActivate(Sender: TObject);
begin
edit_name.Text:=edit.str_law.s_name;
combobox_sex.Text:=edit.str_law.s_sex;
edit_year.Text:=inttostr(edit.str_law.i_year);
edit_zjmh.Text:=edit.str_law.s_zjmh;
edit_dz.Text:=edit.str_law.s_dz;
edit_inc.Text:=edit.str_law.s_inc;
edit_fddbr.Text:=edit.str_law.s_fddbr;
edit_tel.Text:=edit.str_law.s_tel;
edit_number.Text:= inttostr(edit.str_law.i_number);
edit_cphm.Text:=edit.str_law.s_cphm;
combobox_cx.Text:=edit.str_law.s_cx;
edit_cjd.Text:=edit.str_law.s_cjd;
edit_time.Text:=edit.str_law.s_time;
edit_fadz.Text:=edit.str_law.s_fadd;
edit_dcjg.Text:=edit.str_law.s_dcjg;
combobox_clyj.Text:=edit.str_law.s_clyj;
combobox_cfcx.Text:=edit.str_law.s_cfcx;
combobox_zxjg.Text:=edit.str_law.s_zxjg;
edit_bary1.Text:=edit.str_law.s_bary1;
edit_bary2.Text:=edit.str_law.s_bary2;
end;
procedure Tw_date_edit.cb_closeClick(Sender: TObject);
begin
close;
end;
end.
unit data_edit;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, DB, ADODB;
type
Tw_date_edit = class(TForm)
Edit_number: TEdit;
Edit_name: TEdit;
Edit_year: TEdit;
Edit_dz: TEdit;
Edit_zjmh: TEdit;
GroupBox1: TGroupBox;
Edit_inc: TEdit;
Edit_fddbr: TEdit;
Edit_tel: TEdit;
GroupBox2: TGroupBox;
Edit_cphm: TEdit;
ComboBox_cx: TComboBox;
Edit_cjd: TEdit;
Edit_time: TEdit;
Edit_fadz: TEdit;
ComboBox_clyj: TComboBox;
ComboBox_cfcx: TComboBox;
ComboBox_zxjg: TComboBox;
ComboBox_sex: TComboBox;
GroupBox3: TGroupBox;
cb_ok: TButton;
Edit_bary1: TEdit;
cb_close: TButton;
Edit_dcjg: TEdit;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
Label5: TLabel;
Label6: TLabel;
Label7: TLabel;
Label8: TLabel;
Label9: TLabel;
Label10: TLabel;
Label11: TLabel;
Label12: TLabel;
Label13: TLabel;
Label14: TLabel;
Label15: TLabel;
Label16: TLabel;
Label17: TLabel;
Label18: TLabel;
Label19: TLabel;
ADOQuery_fg: TADOQuery;
Edit_bary2: TEdit;
procedure FormCreate(Sender: TObject);
procedure cb_okClick(Sender: TObject);
procedure FormActivate(Sender: TObject);
procedure cb_closeClick(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
w_date_edit: Tw_date_edit;
implementation
uses edit;
{$R *.dfm}
procedure Tw_date_edit.FormCreate(Sender: TObject);
begin
//listbox_bary.Items.Add('李柏洪');
//listbox_bary.Items.Add('王红勤');
combobox_sex.Items.Add('男');
combobox_sex.Items.Add('女');
combobox_cx.Items.Add('大货');
combobox_cx.Items.Add('小货');
combobox_cx.Items.Add('大客');
combobox_cx.Items.Add('小客');
combobox_cx.Items.Add('轿车');
combobox_cx.Items.Add('其它');
ADOQuery_fg.Open;
ADOQuery_fg.First;
while not ADOQuery_fg.Eof do
begin
combobox_clyj.Items.Add(adoquery_fg['法规']);
adoquery_fg.Next;
end;
ADOQuery_fg.Close;
end;
procedure Tw_date_edit.cb_okClick(Sender: TObject);
begin
//edit.w_edit.ADOQuery1.Edit;
edit.w_edit.ADOQuery1['公民']:=edit_name.Text;
edit.w_edit.ADOQuery1['性别']:=combobox_sex.Text;
edit.w_edit.ADOQuery1['年龄']:=strtoint(edit_year.Text);
edit.w_edit.ADOQuery1['证件名号']:=edit_zjmh.Text;
edit.w_edit.ADOQuery1['地址']:=edit_dz.Text;
edit.w_edit.ADOQuery1['单位名称']:=edit_inc.Text;
edit.w_edit.ADOQuery1['法定代表人']:=edit_fddbr.Text;
edit.w_edit.ADOQuery1['电话']:=edit_tel.Text;
edit.w_edit.ADOQuery1['案号']:=strtoint(edit_number.Text);
edit.w_edit.ADOQuery1['牌(证)号']:=edit_cphm.Text;
edit.w_edit.ADOQuery1['车型']:=combobox_cx.Text;
edit.w_edit.ADOQuery1['车籍地']:=edit_cjd.Text;
edit.w_edit.ADOQuery1['发案时间']:=edit_time.Text;
edit.w_edit.ADOQuery1['发案地点']:=edit_fadz.Text;
edit.w_edit.ADOQuery1['调查经过']:=edit_dcjg.Text;
edit.w_edit.ADOQuery1['处理意见']:=combobox_clyj.Text;
edit.w_edit.ADOQuery1['处罚程序']:=combobox_cfcx.Text;
edit.w_edit.ADOQuery1['执行结果']:=combobox_zxjg.Text;
edit.w_edit.ADOQuery1['办案人员一']:=edit_bary1.Text;
edit.w_edit.ADOQuery1['办案人员二']:=edit_bary2.Text;
edit.w_edit.ADOQuery1.Post;
edit.w_edit.ADOQuery1.Active:=false;
edit.w_edit.ADOQuery1.Active:=true;
close;
//showmessage(inttostr(str_law.i_number)+str_law.s_cphm+str_law.s_cx+str_law.s_time);
end;
procedure Tw_date_edit.FormActivate(Sender: TObject);
begin
edit_name.Text:=edit.str_law.s_name;
combobox_sex.Text:=edit.str_law.s_sex;
edit_year.Text:=inttostr(edit.str_law.i_year);
edit_zjmh.Text:=edit.str_law.s_zjmh;
edit_dz.Text:=edit.str_law.s_dz;
edit_inc.Text:=edit.str_law.s_inc;
edit_fddbr.Text:=edit.str_law.s_fddbr;
edit_tel.Text:=edit.str_law.s_tel;
edit_number.Text:= inttostr(edit.str_law.i_number);
edit_cphm.Text:=edit.str_law.s_cphm;
combobox_cx.Text:=edit.str_law.s_cx;
edit_cjd.Text:=edit.str_law.s_cjd;
edit_time.Text:=edit.str_law.s_time;
edit_fadz.Text:=edit.str_law.s_fadd;
edit_dcjg.Text:=edit.str_law.s_dcjg;
combobox_clyj.Text:=edit.str_law.s_clyj;
combobox_cfcx.Text:=edit.str_law.s_cfcx;
combobox_zxjg.Text:=edit.str_law.s_zxjg;
edit_bary1.Text:=edit.str_law.s_bary1;
edit_bary2.Text:=edit.str_law.s_bary2;
end;
procedure Tw_date_edit.cb_closeClick(Sender: TObject);
begin
close;
end;
end.
#10
帮帮我啊,分不够,可以再加啊,谢谢啊
#11
你应该将所报的错误,详细地写出来
#12
把错误的行和错误信息写出来就好了,不用全写出来啊。这样看多慢啊。
#13
就是,把错误信息给出来吧
#14
编译通过,没有错误代码,但一有对数据表的操作(比如ADOQUERY1.EDIT...),就弹出错误对话框,乱七八糟的。