上面窗体的确定按钮里的事件代码:
procedure TXZSP.Button1Click(Sender: TObject);
var
lsqldataset:TSQLDataSet;
str_SPQM,str_SPBH,str_JM,str_PYM,str_XH,str_GG,str_CD,str_DW,str_FZDW,str_DWGX,
str_CBMS,str_TM,str_BZ,str_QJM:string; //字符串
int_YSSJ1,int_YSSJ2,int_YSSJ3,int_LSJ:string; //整g型
// Date_YXQ:TDateTime; //日期字段
SPXX_InsertSQL,KCXX_InsertSQL:string;
begin
//字符串内型
str_SPQM := Self.Edit_SPQM.Text.Trim(); //库存
str_SPBH := Self.Edit_SPBH.Text.Trim(); //库存
str_JM := Self.Edit_JM.Text.Trim();
str_PYM := Self.Edit_PYM.Text.Trim();
str_XH := Self.Edit_XH.Text.Trim(); //库存
str_GG := Self.Edit_GG.Text.Trim(); //库存
str_CD := Self.Edit_CD.Text.Trim(); //库存
str_DW := Self.Edit_DW.Text.Trim(); //库存
str_FZDW := Self.Edit_PZDW.Text.Trim();
str_DWGX := Self.Edit_DWGX.Text.Trim(); //库存
str_CBMS := Self.ComboBox1.Text.Trim();
str_TM := Self.Edit_TM.Text.Trim(); //库存
str_BZ := Self.Com1.Text.Trim(); //库存
str_QJM := Self.Edit_QJM.Text.Trim();
//数字类型
int_YSSJ1 := self.Edit_YSSJ1.Text.Trim();
int_YSSJ2 := self.Edit_YSSJ2.Text.Trim();
int_YSSJ3 := self.Edit_YSSJ3.Text.Trim();
int_LSJ := self.Edit_LSJ.Text.Trim();
//日期
// Date_YXQ := Self.DateTimePicker1.Date;
SPXX_InsertSQL:='insert into SPXX(SPXX_SPQM,SPXX_SPBH,SPXX_JM,SPXX_PYM,SPXX_XH,SPXX_GG,SPXX_CD,'
+ 'SPXX_DW,SPXX_FZDW,SPXX_DWGX,SPXX_CBMS,SPXX_YSSJ1,SPXX_YSSJ2,SPXX_YSSJ3,SPXX_LSJ,SPXX_YXQ,'
+ 'SPXX_TM,SPXX_BZ,SPXX_QJM) values(''' + str_SPQM + ''',''' + str_SPBH + ''',''' +
str_JM + ''',''' + str_PYM + ''',''' + str_XH + ''',''' + str_GG + ''',''' +
str_CD + ''',''' + str_DW + ''',''' + str_FZDW + ''',''' + str_DWGX + ''',''' +
str_CBMS + ''',' + int_YSSJ1 + ',' + int_YSSJ2 + ',' + int_YSSJ3 + ',' + int_LSJ
+ ',:YXQ,''' + str_TM + ''',''' + str_BZ + ''',''' + str_QJM + ''')';
lsqldataset:=TSQLDataSet.Create(Self);
lsqldataset.Database.URL:='Biz:\JXC_GJP_\SJK.Database';
with lsqldataset do
begin
Close;
sql.Text:=SPXX_InsertSQL;
Params.ParamByName('YXQ').AsDate := Self.DateTimePicker1.Date;
Execute;
end;
ModalResult :=Business.Forms.Controls.mrOK;
end; |