简体   繁体   English

如何通过dbgrid更改mysql数据库的值?

[英]How to change values of a mysql database via dbgrid?

Hey guys good morning, 大家早上好,

i got a DBGrid and the UniDac components. 我有一个DBGrid和UniDac组件。 I a use a popupmenu and select a row. 我使用弹出菜单并选择一行。 I fill via the onclick event from the popupmenu a new form with my data in my TEdit. 我通过弹出菜单中的onclick事件填写了一个新表单,其中包含我的TEdit中的数据。

Now the problem is, that i want to edit my data which i selected from the dbgrid. 现在的问题是,我要编辑从dbgrid中选择的数据。

This code works until dbgrid is refreshed and then the old values are back again in my dbgrid. 该代码将一直有效,直到刷新dbgrid,然后再次将旧值恢复到我的dbgrid中。 How can i change it for the mysql table too not only for the dbgrid? 我怎样才能不仅为dbgrid更改mysql表的内容?

My actually Code: 我的实际代码:

   FQuery.Edit;
   FQuery.FieldByName('CfgUID').AsString := Edit4.Text;
   FQuery.FieldByName('CfgMod').AsString := Edit1.Text;
   FQuery.Post;

解决方案是禁用CachedUpdates或在发布后调用ApplyUpdates。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM