B
beadly
Unregistered / Unconfirmed
GUEST, unregistred user!
procedure Tifleave.BitBtn1Click(Sender: TObject);
begin
case RadioGroup1.ItemIndex of
0:WhyLeft:='L';
1:WhyLeft:='D';
2:WhyLeft:='F';
end;
LeftDate:=DateToStr(datetimepicker1.Date);
OtherThing:=Memo1.Text;
with Frm_Datain1.ADOCommand1 do begin
CommandText:='insert into salarout select *,'+LeftDate+' as levdate,'+WhyLeft+' as whylev from salaryin where no=:NoParam';
Parameters[0].Value:=Frm_Datain1.DBEdit1.Text;
Execute;
CommandText:='delete salaryin where no=:NoParam';
Parameters[0].Value:=Frm_Datain1.DBEdit1.Text;
Execute;
end;
Frm_Datain1.AdoDataset1.Requery;
Frm_Datain1.bAppend:=false;
end;
几个变量在前面都已经定义;
但这句有错CommandText:='insert into salarout select *,'+LeftDate+' as levdate,'+WhyLeft+' as whylev from salaryin where no=:NoParam';
比如当WhyLeft='L'时,报错:列名'L'无效,表结构是没错的,
我故意换成CommandText:='insert into salarout select *,'+LeftDate+' as levdate,'+'''L'' as whylev from salaryin where no=:NoParam';
就没错!为什么会这样啊!
begin
case RadioGroup1.ItemIndex of
0:WhyLeft:='L';
1:WhyLeft:='D';
2:WhyLeft:='F';
end;
LeftDate:=DateToStr(datetimepicker1.Date);
OtherThing:=Memo1.Text;
with Frm_Datain1.ADOCommand1 do begin
CommandText:='insert into salarout select *,'+LeftDate+' as levdate,'+WhyLeft+' as whylev from salaryin where no=:NoParam';
Parameters[0].Value:=Frm_Datain1.DBEdit1.Text;
Execute;
CommandText:='delete salaryin where no=:NoParam';
Parameters[0].Value:=Frm_Datain1.DBEdit1.Text;
Execute;
end;
Frm_Datain1.AdoDataset1.Requery;
Frm_Datain1.bAppend:=false;
end;
几个变量在前面都已经定义;
但这句有错CommandText:='insert into salarout select *,'+LeftDate+' as levdate,'+WhyLeft+' as whylev from salaryin where no=:NoParam';
比如当WhyLeft='L'时,报错:列名'L'无效,表结构是没错的,
我故意换成CommandText:='insert into salarout select *,'+LeftDate+' as levdate,'+'''L'' as whylev from salaryin where no=:NoParam';
就没错!为什么会这样啊!