L
luoqing1235678
Unregistered / Unconfirmed
GUEST, unregistred user!
var
syts:integer;
begin
query1.Active:=true;
with query1 do
begin
query1.Close;
query1.SQL.Clear;
query1.SQL.Add('update rwb set srts=wcdate-date+1 where wczt=''未完成''');
//query1.ParamByName('a').AsInteger:=query1.FieldValues['qsdate']-trunc(date)+1;
query1.ExecSQL;
end;
我想计算表中的每条记录中剩余天数(srts),用完成时间(wcdate)-当前日期!
结果提示我,缺少参数,期望值2。我用的是access数据库!
with form5.Query1 do
begin
try
form5.Query1.Edit;
form5.Query1.FieldByName('ywname').AsString:=trim(edit1.Text);
form5.Query1.FieldByName('apbm').AsString:=trim(edit2.Text);
form5.Query1.FieldByName('cbbm').AsString:=trim(edit3.Text);
form5.Query1.FieldByName('qsdate').AsDateTime:=strtodate(trim(edit5.Text));
form5.Query1.FieldByName('wcdate').AsDateTime:=strtodate(trim(edit6.Text));
form5.Query1.FieldByName('wczt').AsString:=combobox1.Text;
form5.Query1.FieldByName('sfdb').AsString:=combobox2.Text;
form5.Query1.FieldByName('zzwcdate').AsString:=trim(edit4.Text);
form5.Query1.Post;
application.MessageBox('修改成功!','提示',0+64);
except
application.MessageBox('系统出错!','提示',0+64);
close;
end;
end;
form5.DBGrid1.Refresh;
close;
end;
这个修改运行不提示错误,但没结果!
begin
if application.MessageBox('你确认要删除该条员工信息吗?','系统提示',MB_YesNo OR MB_defbutton2 or mb_iconstop or mb_applmodal)=idyes then
begin
with query1 do
begin
try
query1.Delete;
showmessage('该条员工信息已删除,删除成功!');
except
cancel;
showmessage('删除数据时出现错误,删除失败!!');
end;
end;
dbgrid1.Refresh;
end;
此删除也是如修改一样!
syts:integer;
begin
query1.Active:=true;
with query1 do
begin
query1.Close;
query1.SQL.Clear;
query1.SQL.Add('update rwb set srts=wcdate-date+1 where wczt=''未完成''');
//query1.ParamByName('a').AsInteger:=query1.FieldValues['qsdate']-trunc(date)+1;
query1.ExecSQL;
end;
我想计算表中的每条记录中剩余天数(srts),用完成时间(wcdate)-当前日期!
结果提示我,缺少参数,期望值2。我用的是access数据库!
with form5.Query1 do
begin
try
form5.Query1.Edit;
form5.Query1.FieldByName('ywname').AsString:=trim(edit1.Text);
form5.Query1.FieldByName('apbm').AsString:=trim(edit2.Text);
form5.Query1.FieldByName('cbbm').AsString:=trim(edit3.Text);
form5.Query1.FieldByName('qsdate').AsDateTime:=strtodate(trim(edit5.Text));
form5.Query1.FieldByName('wcdate').AsDateTime:=strtodate(trim(edit6.Text));
form5.Query1.FieldByName('wczt').AsString:=combobox1.Text;
form5.Query1.FieldByName('sfdb').AsString:=combobox2.Text;
form5.Query1.FieldByName('zzwcdate').AsString:=trim(edit4.Text);
form5.Query1.Post;
application.MessageBox('修改成功!','提示',0+64);
except
application.MessageBox('系统出错!','提示',0+64);
close;
end;
end;
form5.DBGrid1.Refresh;
close;
end;
这个修改运行不提示错误,但没结果!
begin
if application.MessageBox('你确认要删除该条员工信息吗?','系统提示',MB_YesNo OR MB_defbutton2 or mb_iconstop or mb_applmodal)=idyes then
begin
with query1 do
begin
try
query1.Delete;
showmessage('该条员工信息已删除,删除成功!');
except
cancel;
showmessage('删除数据时出现错误,删除失败!!');
end;
end;
dbgrid1.Refresh;
end;
此删除也是如修改一样!