因为我的dataset保存了查询数据'select * from mytable' 我怕执行了其他sql语句会使这些数据没了
问题要修改, ds.Edit; if ds.Locate('CS_CarID', '粤A V403', [loCaseInsensitive]) then ds.FieldByName('CS_WinID').Value := 2; 我的dataset使用编程时选定的SQL语句,其所有字段都是ReadOnly=false,显示用的DBGrid也是 ReadOnly=false, 为什么执行到最后一句就报异常:dataset is not in edit or insert mode呢? 我的插入操作都能顺利执行的啊。 顺便说说,我的dataset是clUseClient的。(有关系吗?!)
我怕执行了其他sql语句会使这些数据没了
ds.Edit;
if ds.Locate('CS_CarID', '粤A V403', [loCaseInsensitive]) then
ds.FieldByName('CS_WinID').Value := 2;
我的dataset使用编程时选定的SQL语句,其所有字段都是ReadOnly=false,显示用的DBGrid也是
ReadOnly=false,
为什么执行到最后一句就报异常:dataset is not in edit or insert mode呢?
我的插入操作都能顺利执行的啊。
顺便说说,我的dataset是clUseClient的。(有关系吗?!)
提一下,DataSet的ReadOnly=False的时候数据库也不一定处于可编辑状态.
begin
ds.Edit;
ds.FieldByName('CS_WinID').Value := 2;
end;
这样就可以了