【问题标题】:Cannot Find Reference To TableAdapter c#找不到对 TableAdapter c# 的引用
【发布时间】:2016-02-18 13:06:32
【问题描述】:

我在我的解决方案中添加了一个数据源,它生成了一个数据集和表适配器。我无法从我的主表单中引用这些表适配器。

例子:

        try
        {
            user_count = (int)this.UsersTableAdapter.count_users();

        } catch (NullReferenceException e)
        {
            MessageBox.Show(e.Message);
        }

错误:

Main 不包含 UsersTableAdapter 的定义

我在 DataSet.Designer.cs 中找到了这些适配器的定义 如何导入或引用这些定义以在我的 Main.cs 中使用?

【问题讨论】:

    标签: c# tableadapter strongly-typed-dataset visual-studio-2015


    【解决方案1】:

    我需要在我的 Main.Designer.cs 文件中声明和实例化我的数据集和表适配器,以便在我的 Main.cs 表单中可以访问它们。

    【讨论】:

      猜你喜欢
      • 2019-04-14
      • 2019-06-07
      • 1970-01-01
      • 1970-01-01
      • 2016-12-27
      • 1970-01-01
      • 2014-09-28
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多