在代码的designer.cs部分中,我只是使组合框数据库驱动(它很好地预览了数据,因此可以正常工作),但是当我尝试编译时,它给我带来了两个独特的错误:
1)错误1类型名称'mtdDesktopApplicationDataSet'在类型'DesktopApplication.DesktopApplication'中不存在
2)错误2类型名称'mtdDesktopApplicationDataSetTableAdapters'在类型'DesktopApplication.DesktopApplication'中不存在
第一个错误在第一行,其他错误在“ mtdDesktopApplicationDataSetTableAdapters”所在的位置显示(4行)
所有适当的文件似乎都在那里,但是它们没有正确连接吗?
this.mtdDesktopApplicationDataSet = new DesktopApplication.mtdDesktopApplicationDataSet();
this.tblStudyBindingSource = new System.Windows.Forms.BindingSource(this.components);
this.tblStudyTableAdapter = new DesktopApplication.mtdDesktopApplicationDataSetTableAdapters.tblStudyTableAdapter();
this.tblDeliveryGroupBindingSource = new System.Windows.Forms.BindingSource(this.components);
this.tblDeliveryGroupTableAdapter = new DesktopApplication.mtdDesktopApplicationDataSetTableAdapters.tblDeliveryGroupTableAdapter();
this.tblDeliveryBindingSource = new System.Windows.Forms.BindingSource(this.components);
this.tblDeliveryTableAdapter = new DesktopApplication.mtdDesktopApplicationDataSetTableAdapters.tblDeliveryTableAdapter();
this.tblDeliveryDataSetBindingSource = new System.Windows.Forms.BindingSource(this.components);
this.tblDeliveryDataSetTableAdapter = new DesktopApplication.mtdDesktopApplicationDataSetTableAdapters.tblDeliveryDataSetTableAdapter();
((System.ComponentModel.ISupportInitialize)(this.mtdDesktopApplicationDataSet)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.tblStudyBindingSource)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.tblDeliveryGroupBindingSource)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.tblDeliveryBindingSource)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.tblDeliveryDataSetBindingSource)).BeginInit();
最佳答案
我猜想您在命名空间方面遇到了一些问题。如果此代码隐藏文件位于DesktopApplication
命名空间中,并且在DesktopApplication
命名空间中还具有DesktopApplication
类,则您将遇到上述情况。
(基本上,它在查看DesktopApplication.DesktopApplication
时应该在查看DesktopApplication
。)
尝试清理名称空间,使以上内容不成立,或者使用global
关键字逃避名称空间地狱:
this.mtdDesktopApplicationDataSet = new global::DesktopApplication.mtdDesktopApplicationDataSet();
关于c# - VS2005,C#-数据绑定(bind)组合框-默认情况下,背后的代码给我错误,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/893319/