在命令和数据源之间混合 [英] Mixing between command and Datasource

查看:59
本文介绍了在命令和数据源之间混合的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,

当我使用命令删除数据网格上显示的所有记录时使用Access DB,除非我使用保存事件,否则它不会刷新

Using Access DB when I use command to delete all records which display on Datagrid but it is not refreshed unless I use save event

this.validat();

this.validat();

Datasource.endEdit

Datasource.endEdit

TableManager.UpdateAll ...

TableManager.UpdateAll ...

那么在删除命令和数据集之间混合使用时应该怎么做?

so what should be done take effect when mixing between command deleting and Dataset?


谢谢

---


推荐答案

你好,

当您说命令时,您的意思是这样的.在这种情况下,DataGridView对您在此级别上所做的事情一无所知.相反,删除应该针对DataGridView中的数据进行,保存时DataGridVIew将反映该数据 所做的更改没有刷新.如果这不是您执行删除操作的方式,请显示您的代码.

When you say command, do you mean something like this. If that is the case the DataGridView knows nothing about what you did at this level. Instead the delete should happen against the data in the DataGridView which when saved the DataGridVIew will reflect the changes with no refresh. If this is not how you are performing the deletes please show your code.

public void Example()
{
    using (OleDbConnection cn = new OleDbConnection() { ConnectionString = "TODO" })
    {
        using (OleDbCommand cmd = new OleDbCommand() { Connection = cn })
        {
            // Delete record from database
        }
    }
}


这篇关于在命令和数据源之间混合的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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