CSDN首页 空间 新闻 论坛 Blog 下载 读书 网摘 搜索 .NET Java 视频 接项目 求职 在线学习 买书 程序员 通知
山寨机中的战斗机! 程序优化工程师到底对IT界有没有贡献
CSDN社区
搜索 收藏 打印 关闭
CSDN社区 >  Delphi >  VCL组件开发及应用

用query查询出的记录,修改后一结束查询发现没改过,cache中的数据不提交怎么办?

楼主chenjiong(准程序员:升级中....)2001-04-10 09:47:00 在 Delphi / VCL组件开发及应用 提问

用了tquery,tupdatasql,query的requestlive:=true   updateobjext:=updatesql1  
  cachedupdates:=true,但就是不能更改,改过后结束查询就不变动原记录。疑是cache中的数据没写入库中。在论坛上找了一帖子,在query的afterpost中写query1.applyupdates[query1];结果编译时说什么重复了,不通。请问应该是如何写?  
  顺便再问一下,updatesql中有几个关于插入,删除记录的属性,那里的sql是怎么写的?比如我要删除当前查出的记录。 问题点数:35、回复次数:13Top

1 楼chenjiong(准程序员:升级中....)回复于 2001-04-10 10:06:00 得分 0

query1.applyupdates[query1];这一句错在哪Top

2 楼yukuang(编程是我的业余爱好)回复于 2001-04-10 10:22:00 得分 0

query1.applyupdatesTop

3 楼chenjiong(准程序员:升级中....)回复于 2001-04-10 10:44:00 得分 0

我原先已经用过了,也是没有变化的。Top

4 楼coldljy(青山隐隐)回复于 2001-04-10 10:49:00 得分 0

HELP中写道:  
  Call   ApplyUpdates   to   write   a   dataset   pending   cached   updates   to   a   database.   This   method   passes   cached   data   to   the   database   for   storage,   but   the   changes   are   not   committed   to   the   database.   An   application   must   explicitly   call   the   database   component抯   Commit   method   to   commit   the   changes   to   the   database   if   the   write   is   successful,   or   call   the   database   Rollback   method   to   undo   the   changes   if   there   is   an   error.  
   
  e.g.  
  he   following   procedure   illustrates   how   to   apply   a   dataset   cached   updates   to   a   database   in   response   to   a   button   click:  
   
  procedure   TForm1.ApplyButtonClick(Sender:   TObject);  
   
  begin  
      with   CustomerQuery   do  
      begin  
      Database1.StartTransaction;  
          try  
              ApplyUpdates;   {try   to   write   the   updates   to   the   database};  
              Database1.Commit;   {on   success,   commit   the   changes};  
          except  
              Database1.Rollback;   {on   failure,   undo   the   changes};  
          raise;   {raise   the   exception   to   prevent   a   call   to   CommitUpdates!}  
          end;  
      CommitUpdates;   {on   success,   clear   the   cache}  
      end;  
   
  end;Top

5 楼chenjiong(准程序员:升级中....)回复于 2001-04-10 11:03:00 得分 0

呵呵,还是不懂。Database1是指什么?Top

6 楼chenjiong(准程序员:升级中....)回复于 2001-04-10 12:54:00 得分 0

能加上注释不?Top

7 楼taogou(下面?没有了)回复于 2001-04-10 13:05:00 得分 0

database1,不就是一个控件了!Top

8 楼chenjiong(准程序员:升级中....)回复于 2001-04-10 13:09:00 得分 0

您真聪明!Top

9 楼chenjiong(准程序员:升级中....)回复于 2001-04-10 13:10:00 得分 0

哪位兄弟能解释几句听听,对帮助中的那段代码。Top

10 楼chenjiong(准程序员:升级中....)回复于 2001-04-10 14:31:00 得分 0

自己弄了会,出来一个no   sql   statement   available的出错信息来,是在我更改了查询出的记录后出现的,什么意思?Top

11 楼chenjiong(准程序员:升级中....)回复于 2001-04-10 14:35:00 得分 0

难道是要在什么地方写上sql语句?在updatesql上写?我的那段语句是在query1的afterpost中加上:table1.close;  
  datasource1.dataset:=query1;  
  query1.applyUpdates;  
  结果是会出提示,确定后能改变记录,但不能保存。Top

12 楼chenjiong(准程序员:升级中....)回复于 2001-04-10 15:27:00 得分 0

ok,行了,自己解决了。多谢名位。  
  Top

13 楼yaoyaozhang(瑶瑶)回复于 2001-08-23 09:45:32 得分 35

结帐了。Top

相关问题

  • 怎么样才知道记录被修改过?(关于 cachedupdates )
  • 如何检测表的数据记录是否修改过。
  • 如何知道DBGrid的记录是否有更改过?
  • 执行update语句后,求被修改过的记录条数。
  • 怎样判断数据库的记录是否被修改过呀
  • modified()函数不够用!如何检测一条记录从open后至update之前,有没有被修改过?
  • 利用QUERY添加记录的问题?
  • QUERY实现增加记录的更能???
  • Query的SQL更新记录问题!
  • 数据库记录的CACHE问题

关键词

  • 查询
  • database
  • applyupdates
  • 记录
  • query
  • updatesql
  • cached
  • commit
  • changes
  • dataset

得分解答快速导航

  • 帖主:chenjiong
  • yaoyaozhang

相关链接

  • Delphi类图书
  • Delphi类源码下载
  • Delphi控件下载

广告也精彩

反馈

请通过下述方式给我们反馈
反馈
提问
网站简介|广告服务|VIP资费标准|银行汇款帐号|网站地图|帮助|联系方式|诚聘英才|English|问题报告
北京创新乐知广告有限公司 版权所有, 京 ICP 证 070598 号
世纪乐知(北京)网络技术有限公司 提供技术支持
Copyright © 2000-2008, CSDN.NET, All Rights Reserved
GongshangLogo