使用Visual Studio 2010添加assmbly引用SqlServerCe [英] Adding assmbly reference SqlServerCe, using Visual studio 2010
问题描述
我正在尝试使用C#连接数据库。在Visual Studio 2010中。
这是代码设置SqlServerCe连接变量
I am trying to connect a database using C# . in a visual studio 2010.
this is the code To set up a SqlServerCe connection variable
System.Data.SqlServerCe.SqlCeConnection con; // outside the form load
con = new System .Data .SqlServerCe.sqlCeConnection(); //inside the form load
I得到一个错误说:
I get an error saying:
sqlServerCe does not exist in the namespace.
我所知道的是我需要添加程序集引用。我怎么做?
请帮忙。
注意:
此程序集(SqlServerCe)是SQL Server Compact Edition的一部分,而不是Microsoft .net Framework的一部分。所以我必须在VS 2010专业版中手动添加它。如何手动添加?
What I know is that i need to add an assembly reference. How do i do that?
please help.
NB:
this assembly (SqlServerCe) is part of SQL Server Compact Edition and not part of Microsoft .net Framework. so i have to add it manually in VS 2010 professional. how do i add it manually?
推荐答案
请参阅此处: http://msdn.microsoft.com/en-us/library/system.data.sqlserverce.sqlceconnection(v = VS.80)的.aspx [ ^ ]
See here: http://msdn.microsoft.com/en-us/library/system.data.sqlserverce.sqlceconnection(v=vs.80).aspx[^]
命名空间:System.Data.SqlServerCe
汇编:System.Data.SqlServerCe(在system.data.sqlserverce.dll中)
Namespace: System.Data.SqlServerCe
Assembly: System.Data.SqlServerCe (in system.data.sqlserverce.dll)
这里描述了如何添加引用:http://msdn.microsoft.com/en-us/library/wkze6zky(v=vs.80) .aspx [ ^ ]到一个组织。这个应该是第一类。
Here described is how you can add a reference: http://msdn.microsoft.com/en-us/library/wkze6zky(v=vs.80).aspx[^] to an assambly. This one should be in the first category.
我找到了另一种解决方案。
使用连接到sql数据库在Microsoft Visual Studio中使用C#,您必须手动添加sqlSeverCe名称引用。
即您单击Project>>>添加引用
弹出
a窗口,单击浏览选项卡。
浏览到C:\Program Files \ Microsoft SQL Server Compact edition \v3.5 \Desktop
然后双击System .Data .SqlServerCe文件,
按OK。
i have found an alternative solution.
To connect to the sql database using C# in Microsoft Visual studio,you have to amanually add the sqlSeverCe name reference manually.
that is you click on Project>>>Add Reference
a window pops up, click on the browse tab.
browse to C:\Program Files\Microsoft SQL server Compact edition\v3.5\Desktop
then double click on the System .Data .SqlServerCe file,
press OK.
这篇关于使用Visual Studio 2010添加assmbly引用SqlServerCe的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!