数据修改的问题

foundAnswer 2003-06-23 09:12:46
我通过StringGrid修改ADODataSet中的数据,下面是代码:


procedure TfrmGroupList.grdGroupListSetEditText(Sender: TObject; ACol,
ARow: Integer; const Value: String);
var
i: Integer;
begin
i := 0;
ADSGroupList.First;
while i < (ARow - 1) do
begin
ADSGroupList.Next;
Inc(i);
end;
ADSGroupList.Edit;
ADSGroupList.Fields[ACol].Value := grdGroupList.Cells[ACol,ARow];
end;

总是报Field "XXX" can not be modified.
谁能告诉我为什么?谢谢。
...全文
26 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
foundAnswer 2003-06-24
  • 打赏
  • 举报
回复
我想应该有人碰过这种问题吧!
foundAnswer 2003-06-24
  • 打赏
  • 举报
回复
我要急死了!Field "XXX" can not be modified!!!
foundAnswer 2003-06-24
  • 打赏
  • 举报
回复
还是不行呀。如果ADSGroupList.Edit提前,在执行ADSGroupList.First后,ADSGroupList.State的值就变成了dsBrowser.
kds 2003-06-24
  • 打赏
  • 举报
回复
procedure TfrmGroupList.grdGroupListSetEditText(Sender: TObject; ACol,
ARow: Integer; const Value: String);
var
i: Integer;
begin
i := 0;

ADSGroupList.Edit; //位置改变

ADSGroupList.First;
while i < (ARow - 1) do
begin
ADSGroupList.Next;
Inc(i);
end;
//ADSGroupList.Edit;
ADSGroupList.Fields[ACol].Value := grdGroupList.Cells[ACol,ARow];
end;
foundAnswer 2003-06-24
  • 打赏
  • 举报
回复
我已经open了,还是抱着个错呀!
lovelymelon 2003-06-24
  • 打赏
  • 举报
回复
对在ADSGroupList.Edit;前加上ADSGroupList.open
lion_lh 2003-06-23
  • 打赏
  • 举报
回复
ADSGroupList.open了没有

5,391

社区成员

发帖
与我相关
我的任务
社区描述
Delphi 开发及应用
社区管理员
  • VCL组件开发及应用社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧