【问题标题】:C# and MS Access database (updating)C# 和 MS Access 数据库(更新)
【发布时间】:2009-07-28 13:46:34
【问题描述】:

我在C# 中创建了一个Windows Forms 应用程序,在我为保存按钮编码的表单上从我的MS Access 数据库“inspro”中创建了一个C# 数据源:

try
{
    this.Validate();
    this.entitiesBindingSource.EndEdit();
    this.entitiesTableAdapter.Update(this.iNSPRODataSet.Entities);
    MessageBox.Show("Update successful");
}
catch (System.Exception ex)
{
    MessageBox.Show("Update failed");
}

我收到显示“更新成功”的消息框,但是当我签入 Access 时,没有任何更新。我该如何解决这个问题?

【问题讨论】:

    标签: c# ms-access ado.net tableadapter


    【解决方案1】:

    它可能与EndEdit() bug that has caught many others 有关。如果它移动焦点,这可能就是您没有看到预期保存的原因。

    另一种可能性,阅读comments at the bottom of this page,它与移动到调试文件夹的 MDF 副本有关,有效地覆盖了更改。

    {EDIT} 正如 Julien 所指出的,我提到的第二篇文章引用了一个 MDF(SQL Server),并且访问将是一个 MDB,但那里的理论仍然是合理的。检查包含的文件是否设置为复制到输出目录。

    【讨论】:

    • 你说得对,我的回答与问题无关。我删除了它。顺便说一句,他使用的是 Access,所以它是一个 .mdb 文件
    猜你喜欢
    • 2012-04-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-06-25
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多