C#.net中连接ms Access数据库的问题 [英] problem in connecting ms access database in C#.net

查看:80
本文介绍了C#.net中连接ms Access数据库的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我正在将ms-access数据库连接到我的c#.net应用程序.

连接成功后,我将生成名为dataset1的数据集,它也完成了,但是在此之后,当我尝试打开该表单的设计视图时,出现以下错误.

Hi
I am connecting a ms-access database to my c#.net application.

Connection is successfull then i''hv generated dataset named dataset1 its also done, but after that when i am trying to open design view of that form, i get following error.

1.Could not find type ''DataSet1''. Please make sure that the assembly that contains this type is referenced. If this type is a part of your development project, make sure that the project has been successfully built.

2.The variable ''dataSet11'' is either undeclared or was never assigned.



我还将发布我的.designer
自动生成代码的一部分



I am also posting some part of my auto generated code of .designer


System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Form2));
this.oleDbSelectCommand1 = new System.Data.OleDb.OleDbCommand();
this.oleDbInsertCommand1 = new System.Data.OleDb.OleDbCommand();
this.oleDbUpdateCommand1 = new System.Data.OleDb.OleDbCommand();
this.oleDbDeleteCommand1 = new System.Data.OleDb.OleDbCommand();
this.oleDbDataAdapter1 = new System.Data.OleDb.OleDbDataAdapter();
this.oleDbConnection1 = new System.Data.OleDb.OleDbConnection();
this.dataSet11 = new FTServerCode.DataSet1();//this line creates problem
this.textBox1 = new System.Windows.Forms.TextBox();
this.textBox2 = new System.Windows.Forms.TextBox();
this.button1 = new System.Windows.Forms.Button();
this.textBox3 = new System.Windows.Forms.TextBox();
((System.ComponentModel.ISupportInitialize)(this.dataSet11)).BeginInit();
this.SuspendLayout();
//
// oleDbSelectCommand1



预先谢谢您.



Thank you in advance

推荐答案

您说您创建了Dataset1并缺少对dataset11(* eleven)的引用,我认为这是一个错字.
you say you created Dataset1 and have a missing reference to dataset11 (*eleven) that is a typo I believe.


您需要做的是将数据源添加到项目中,然后将自动生成的数据集从数据源"资源管理器中拖到表单上.听起来好像您正在从工具箱中添加数据集.如果您尝试自己编写代码,请这样做,并且不要与自动生成的代码混合使用,除非您知道如何纠正将要发生的代码混乱.
What you need to do is add the datasource to the project, then drag the autogenerated dataset onto the form from the Data source explorer. Sounds like you are adding the dataset from the toolbox. if you are trying to write the code yourself, do so and do not mix and match with auto generated unless you know how to correct the code mess that will happen.


添加数据源时到一个项目,您会在VS 2005/2008/2010中获得datsource资源管理器窗口吗?
oleDBadapter也是从哪里来的?它是自动生成的吗? dataAdapter通常是从强类型的xsd数据集生成的,该数据集是从数据库生成的.
这一切通常是通过拖放过程发生的.这些自动生成的项目然后被添加到工具箱,如果您再次拖放它们,则会添加一个增量分母来为其指定实例名称.
即customerTableadapter1
customerTableadapter2

您想做什么?
When you add a datasource to a project you get a datsource explorer window in VS 2005 / 2008 /2010 ?
Also where is the oleDBadapter coming from ? is it auto-generated. The dataAdapter is normally generated from the strongly typed xsd dataset, which is generated from the database.
This all occurs from the drag and drop procedure normally. These auto generated items are then added to the toolbox, if you then drag and drop them again an incremental denominator is added to give them instance names.
ie customerTableadapter1
customerTableadapter2
etc.
What are you trying to do ?


这篇关于C#.net中连接ms Access数据库的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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