超奇怪问题:数据集append后提示Dataset not in edit or insert mode

星幻子 2012-03-08 09:45:12
超奇怪问题 一直运行很好,后来客户要求添加点新功能,可是新功能与出问题的模块毫无关联

代码片段 如下
with DM.ADT_JMoney do
begin
Append;
if (DM.ADQ_Student.FieldByName('XOLDMARK').AsBoolean)and(N18.Checked) then
FieldByName('XSN').AsString := DM.ADQ_Student.FieldByName('XOLDSN').AsString
else
FieldByName('XSN').AsString := DM.ADQ_Student.FieldByName('XSN').AsString;

当程序运行到两个赋值语句之一时就报错,错误很常见: Dataset not in edit or insert mode

我这里用的是SQLServer 2008, 客户用的是 2000,数据库是在2000上建立的,都会提示错误
要疯了,还请各位帮忙,在线等!!
...全文
306 13 打赏 收藏 转发到动态 举报
写回复
用AI写文章
13 条回复
切换为时间正序
请发表友善的回复…
发表回复
星幻子 2012-03-08
  • 打赏
  • 举报
回复
问题解决了!!!!!

我开发程序时用的是 EhLib 5284
后来重装系统换WIN7 用的是 EHLIB 5.5

哈哈,蛋疼啊!!!!
星幻子 2012-03-08
  • 打赏
  • 举报
回复
真他娘奇怪啊!!!!!!!!!!!!!!!!!!!
我特地添加个BUTTON 代码为 DM.ADT_JMoney.Append;

开始一直点 没反应 ,后来发现,当我变换ADT_JMoney的主表的数据有时会出现错误:
BOF 或 EOF 中有一个是“真”,或者当前的记录已被删除,所需的操作要求一个当前的记录

出错后再点BUTTON居然有用,而且上面的问题也消失了!!!

顺便说下 这个 ADT_JMoney 是ADOTable,作为一个ADOQuery 的从表
星幻子 2012-03-08
  • 打赏
  • 举报
回复
[Quote=引用 10 楼 case5166 的回复:]

引用 9 楼 13001602 的回复:
with do 去掉也不行
State也看了,Append后立马是dsBrowse
那只能断点跟踪了,或许是不是BEFORINSERT之类的东东?

还是QUERY的相关属性设置了ReadOnly之类的,
[/Quote]
呵呵,全部没有~~~
我看见佛 2012-03-08
  • 打赏
  • 举报
回复
[Quote=引用 9 楼 13001602 的回复:]
with do 去掉也不行
State也看了,Append后立马是dsBrowse
[/Quote]那只能断点跟踪了,或许是不是BEFORINSERT之类的东东?

还是QUERY的相关属性设置了ReadOnly之类的,
星幻子 2012-03-08
  • 打赏
  • 举报
回复
with do 去掉也不行
State也看了,Append后立马是dsBrowse
星幻子 2012-03-08
  • 打赏
  • 举报
回复
with do 去掉过了,没用
state 也看了,append后立马就是dsBrowse
星幻子 2012-03-08
  • 打赏
  • 举报
回复
他妈的,刚测试下问题消失了一阵子,然后又出现了,见鬼了
我看见佛 2012-03-08
  • 打赏
  • 举报
回复
先把WITH DO去掉吧,全部加上完整名称试试,有时WITH DO不注意确实会产生很多奇怪的问题
Append后加上if DM.ADQ_Student.state = dsBrowse then showmessage('看看');
FieldByName('XSN').AsString := DM.ADQ_Student.FieldByName('XOLDSN').AsString
星幻子 2012-03-08
  • 打赏
  • 举报
回复
现在修改过功能的模块也出现同样问题了
星幻子 2012-03-08
  • 打赏
  • 举报
回复
名称不会错,FieldByName('XSN') 确实是在 DM.ADT_JMoney 下

我用WatchList看了下
FieldByName('XSN').AsString := DM.ADQ_Student.FieldByName('XOLDSN').AsString
的时候 DM.ADT_JMoney.State 为 dsBrowse

问题是我明明APPEND了
最大的问题是以前一直没问题的,突然出现这么个情况
kaikai_kk 2012-03-08
  • 打赏
  • 举报
回复
设断点在Append位置,跟踪下去看看是不是有其它的代码,已经把DM.ADT_JMoney的状态(State)改变了
我看见佛 2012-03-08
  • 打赏
  • 举报
回复
有点乱乱的,加上完整的名称吧!
我看见佛 2012-03-08
  • 打赏
  • 举报
回复
with DM.ADT_JMoney do
begin
Append;
if (DM.ADQ_Student.FieldByName('XOLDMARK').AsBoolean)and(N18.Checked) then
FieldByName('XSN').AsString := DM.ADQ_Student.FieldByName('XOLDSN').AsString
else
FieldByName('XSN').AsString := DM.ADQ_Student.FieldByName('XSN').AsString;

你这里加了WITH DO

如果FieldByName('XSN')在DM下面则正确的,
若在本窗体内则改成Self.Query.FieldByName('XSN').AsString
What's New in 13.2.5 (VCL Product Line) New Major Features in 13.2 What's New in VCL Products 13.2 Feature Highlights To learn about feature highlights in this version, please refer to the following page: Feature Highlights in 13.2.5 (VCL Product Line) Known Issues To learn about known issues in this version, please refer to the following page: Known Issues in 13.2.5 (VCL Product Line) The following sections list all minor and major changes in DevExpress VCL 13.2.5. Note that products, controls and libraries which aren't mentioned in the list below are included in the unified installer for compatibility, but have not been updated. Enhancements and Updates •New Features/Updates •ExpressVerticalGrid Suite •ExpressEditors Library •Resolved Issues •ExpressBars Suite •ExpressDocking Library •ExpressLayout Control •ExpressPageControl •ExpressPrinting System •ExpressQuantumGrid Suite •ExpressQuantumTreeList Suite •ExpressScheduler Suite •ExpressSkins Library •ExpressTile Control •ExpressVerticalGrid Suite •ExpressWizard Control •ExpressEditors Library •ExpressLibrary •Installation (VCL) New Features/Updates ExpressVerticalGrid Suite •S173543 - Introduce a property providing access to the FNewLoadMode field declared in the TcxCustomVerticalGrid class Common Libraries ExpressEditors Library •S173677 - Documentation - Add a note that resizing an alert window via the standard window size API (properties or methods inherited from TdxAlertWindow ancestor classes) is not recommended Resolved Issues ExpressBars Suite •Q584524 - Ribbon - QAT doesn't display the double arrow if the Ribbon control's PopupMenuItems set does not include items •Q581962 - Ribbon - Switching between maximized MDI child windows using the Ctrl+F6 key combination doesn't make them occupy the entire main window if Ribbon controls on these windows are merged •Q468576 - Switching a floating toolbar's Visible property to True in the BarManager's OnMerge event handler does not show this toolbar
为什么要学习这门课程?·新一代流式数据湖技术组件深入讲解,帮助你快速构造数据湖知识体系。·为构建湖仓一体架构提供底层技术支撑。本课程将从原理、架构、底层存储细节、性能优化、管理等层面对Paimon流式数据湖组件进行详细讲解,原理+实战,帮助你快速上手使用数据湖技术。讲师介绍华为HCIP认证大数据高级工程师北京猎豹移动大数据技术专家中科院大数据研究院大数据技术专家51CTO企业IT学院优秀讲师电子工业出版社2022年度优秀作者出版书籍:《Flink入门与实战》、《大数据技术及架构图解实战派》。本课程提供配套课件、软件、试题、以及源码。课程内容介绍:1、什么是Apache Paimon2、Paimon的整体架构3、Paimon的核心特点4、Paimon支持的生态5、基于Flink SQL操作Paimon6、基于Flink DataStream API 操作Paimon7、Paimon中的内部表和外部表8、Paimon中的分区表和临时表9、Paimon中的Primary Key表(主键表)10、Paimon中的Append Only表(仅追加表)11、Changelog Producers原理及案例实战12、Merge Engines原理及案例实战13、Paimon中的Catalog详解14、Paimon中的Table详解15、Paimon之Hive Catalog的使用16、动态修改Paimon表属性17、查询Paimon系统表18、批量读取Paimon表19、流式读取Paimon表20、流式读取高级特性Consumer ID21、Paimon CDC数据摄取功能22、CDC之MySQL数据同步到Paimon23、CDC之Kafka数据同步到Paimon24、CDC高级特性之Schema模式演变25、CDC高级特性之计算列26、CDC高级特性之特殊的数据类型映射27、CDC高级特性之中文乱码28、Hive引擎集成Paimon29、在Hive中配置Paimon依赖30、在Hive中读写Paimon表31、在Hive中创建Paimon表32、Hive和Paimon数据类型映射关系33、Paimon底层文件基本概念34、Paimon底层文件布局35、Paimon底层文件操作详解36、Flink流式写入Paimon表过程分析37、读写性能优化详细分析38、Paimon中快照、分区、小文件的管理39、管理标签(自动管理+手工管理)40、管理Bucket(创建+删除+回滚)

2,498

社区成员

发帖
与我相关
我的任务
社区描述
Delphi 数据库相关
社区管理员
  • 数据库相关社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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