【发布时间】:2013-08-05 08:59:03
【问题描述】:
我在TabControl 中添加了一个DataGridView 控件,以显示存储在名为Cellar.sdf 的本地应用程序数据库的单个表中的数据。
当我将数据源添加到 DataGridView 时,我选择了要从中显示数据的表并预览数据。它显示数据库内的内容。
当我构建项目时,出现以下错误:
The type name 'CellarDataSetTableAdapters' does not exist in the type 'Winecellar.Winecellar'
The type name 'CellarDataSet' does not exist in the type 'Winecellar.Winecellar'
我的项目名称是'Winecellar'。当我在 VS2012 中创建项目时,它创建了一个子文件夹,导致文件结构 'Winecellar.Winecellar',尽管我不确定这是否与此问题有关。在文件夹里面我确实有文件CellarDataSet 它说我不见了。
我必须为我的数据库创建一个单独的TableAdapter,还是必须以不同的顺序执行操作才能使其正常工作?
导致我的错误的代码行在我的 Form1.Designer.cs 文件中,
(1) this.cellarDataSet = new Winecellar.CellarDataSet();
this.wineBindingSource = new System.Windows.Forms.BindingSource(this.components);
(2) this.wineTableAdapter = new Winecellar.CellarDataSetTableAdapters.WineTableAdapter();
(我在 MSDN 论坛上发现了一个类似的主题,虽然我无法通过阅读解决我的问题。Read it here.
【问题讨论】:
-
我想您的解决方案也称为 WineCellar?所以你有一个
...\WineCellar\WineCellar\WineCellar文件夹? -
在我的项目文件夹中,它的结构为
...\Projects\Winecellar\Winecellar -
那么解决方案文件夹是哪一个?
-
子文件夹(第二个)。
-
请仔细记录您的文件夹结构和命名空间。这是相关部分,我们现在必须猜测。
标签: c# datagridview dataset tableadapter