我在学习写工资系统,在关闭整个系统后出现以下错误:
Table1:cannot perform this operation on a closed dataset?
恳请大虾赐教,在线等待!!!另外,“增加记录”和“保存记录”代码如下:
procedure TRecForm.SpeedButton1Click(Sender: TObject);
var i:integer;
noo:string;
boo:Tbook;
begin
if not DataT.Table4.Active then
DataT.Table4.Open;
if DataT.Table4.RecordCount = 0 then noo:='0';
if DataT.Table4.RecordCount > 0 then
Begin
boo:= DataT.Table4.GetBook;
DataT.Table4.Last;
noo:=DataT.Table4.fieldbyname('EmpId').AsString;
DataT.Table4.GotoBook(boo);
DataT.Table4.FreeBook(boo);
End;
noo:=FloatToStr(StrToInt(noo)+1);
For i:=1 to 5-Length(noo) do
begin
noo:='0'+noo;
end;
application.CreateForm(Taddform,addform);
if AddForm.ShowModal=mrOk then
begin
case AddForm.RadioGroup1.ItemIndex of
0: begin
DataT.Table4.Edit;
DataT.Table4.insert;
end;
1: begin
DataT.Table4.Next;
DataT.Table4.Edit;
DataT.Table4.Insert;
end;
2: begin
DataT.Table4.Last;
DataT.Table4.Edit;
DataT.Table4.Append;
end;
end;
end;
Dbedit1.SetFocus;
Dbedit1.Text:=noo;
RecForm.Caption:='记录管理 记录数为:'+IntToStr(DataT.Table4.RecordCount)+'人';
AddForm.Release;
end;procedure TRecForm.SpeedButton3Click(Sender: TObject);
begin
try
try
with DataT.Table4 do
begin
if not active then open;
edit;
Post;
end;
except
Application.MessageBox('数据发生错误!!!请运行<维护>---><数据清理>菜单项!!!','提示框',mb_ok+mb_iconstop);
abort;
end;
Finally
Application.MessageBox('数据成功保存!!!','提示框',mb_ok+mb_iconinformation);
End;
end;
Table1:cannot perform this operation on a closed dataset?
恳请大虾赐教,在线等待!!!另外,“增加记录”和“保存记录”代码如下:
procedure TRecForm.SpeedButton1Click(Sender: TObject);
var i:integer;
noo:string;
boo:Tbook;
begin
if not DataT.Table4.Active then
DataT.Table4.Open;
if DataT.Table4.RecordCount = 0 then noo:='0';
if DataT.Table4.RecordCount > 0 then
Begin
boo:= DataT.Table4.GetBook;
DataT.Table4.Last;
noo:=DataT.Table4.fieldbyname('EmpId').AsString;
DataT.Table4.GotoBook(boo);
DataT.Table4.FreeBook(boo);
End;
noo:=FloatToStr(StrToInt(noo)+1);
For i:=1 to 5-Length(noo) do
begin
noo:='0'+noo;
end;
application.CreateForm(Taddform,addform);
if AddForm.ShowModal=mrOk then
begin
case AddForm.RadioGroup1.ItemIndex of
0: begin
DataT.Table4.Edit;
DataT.Table4.insert;
end;
1: begin
DataT.Table4.Next;
DataT.Table4.Edit;
DataT.Table4.Insert;
end;
2: begin
DataT.Table4.Last;
DataT.Table4.Edit;
DataT.Table4.Append;
end;
end;
end;
Dbedit1.SetFocus;
Dbedit1.Text:=noo;
RecForm.Caption:='记录管理 记录数为:'+IntToStr(DataT.Table4.RecordCount)+'人';
AddForm.Release;
end;procedure TRecForm.SpeedButton3Click(Sender: TObject);
begin
try
try
with DataT.Table4 do
begin
if not active then open;
edit;
Post;
end;
except
Application.MessageBox('数据发生错误!!!请运行<维护>---><数据清理>菜单项!!!','提示框',mb_ok+mb_iconstop);
abort;
end;
Finally
Application.MessageBox('数据成功保存!!!','提示框',mb_ok+mb_iconinformation);
End;
end;
解决方案 »
- delphi xe2 生成的文件不直接支持unicode吗?怎么在英文XP下中文还是乱码?难道还需装中文语言包?
- 加了个星星,按照惯例散分
- 关于MDI编程,请指教!!!
- [转帖]深圳柴刀匪猖獗 砍手脚抢手机
- 可以截取其它软件上的图标吗?
- 有谁知道动态数组长度的限制?
- 两个txt文件,怎么按行比较差异?????
- 这样作犯法吗?项目开发!!! [所有相关帖子]
- 如何通过编程去控制另外一个程序的运行、暂停和关闭?
- 十万火急!请问如何在在DELPHI下有什么方法可以在客户端为服务器上的SQL SERVER增加权限用户???
- 关于Delphi7
- 像office2000中复制,沾贴,删除按钮上的图标在哪里可以找到
if AddForm.ShowModal=mrOk then
begin
if not DataT.Table4.Active then
DataT.Table4.Open;
case AddForm.RadioGroup1.ItemIndex of
0: begin
DataT.Table4.Edit;
DataT.Table4.insert;
end;
1: begin
DataT.Table4.Next;
DataT.Table4.Edit;
DataT.Table4.Insert;
end;
2: begin
DataT.Table4.Last;
DataT.Table4.Edit;
DataT.Table4.Append;
end;
end;
end;