将更改保存到使用同一表在表单上进行的datagridview记录 [英] Save changes to a datagridview record made on a form using same table

查看:92
本文介绍了将更改保存到使用同一表在表单上进行的datagridview记录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是C#的新手,想双击datagridview并打开一个表单.我已经完成了打开正确记录的操作,但是我似乎无法将记录保存到表中.如果我关闭窗口,它将在datagridview中显示正确的数据,但是当我关闭程序并再次打开它时,旧数据仍然没有更改.

这是我所拥有的:在主菜单中

I am new at C# and would like to doubleclick on a datagridview and open a form. which i have done opening the correct record but I can''t seem to save the record to the table. If I close the window it shows the correct data in the datagridview but when I close the program and open it again the old data remains no changes have taken place.

Here is what i have: in the Main

private void gridControl1_DoubleClick_1(object sender, EventArgs e)
 {
     BindingSource UpClient = new BindingSource();
     UpdClient UpdClnt = new UpdClient(this.crmClientBindingSource);
     UpdClnt.ShowDialog();
 }


格式为:


This is in the form:

public partial class UpdClient : Form
  {
    public UpdClient(BindingSource UpClient)  // UpClient is the data in binding source needed to fill the form 5/7/12 fak
   {
     InitializeComponent();
     this.ItemForClientID.DataBindings.Add("Text", UpClient, "ClientID");
     this.ContactNameTextEdit.DataBindings.Add("Text",UpClient, "ContactName");
     this.FirstNameTextEdit.DataBindings.Add("Text", UpClient, "FirstName");
     this.LastNameTextEdit.DataBindings.Add("Text",UpClient, "LastName");

    }


谢谢

Frank


Thanks

Frank

推荐答案

启用自动回发,以便保存记录.
Enable Auto Post-back so the record is saved.


这篇关于将更改保存到使用同一表在表单上进行的datagridview记录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆