简体   繁体   English

无法将本地SQL数据库添加到VS2010项目?

[英]Can't add local SQL database to VS2010 project?

I've been reading up and doing exercises in Visual Studio 2010 Professional C# . 我一直在阅读并在Visual Studio 2010 Professional C#进行练习。 Everything has worked til' I came across an exercise that asked to create a local SQL database(.sdf). 直到一切正常,直到我遇到一个要求创建本地SQL数据库(.sdf)的练习。 When I add it, it gives me the error message; 当我添加它时,它会给我错误消息。 "The data provider required to connect to the local data file could not be found. The file will be added to the project but the typed DataSet associated with the file will not be generated." “找不到连接到本地数据文件所需的数据提供者。该文件将被添加到项目中,但是不会生成与该文件关联的类型化DataSet。” It will add the database but whenever I try to access it it gives me another error Message; 它会添加数据库,但是每当我尝试访问它时,它都会给我另一个错误消息。

"The operation could not be completed. Unspecified error."

At first, I thought it was a matter of reinstalling SQL Server Compact 3.5 SP2 . 起初,我认为这是重新安装SQL Server Compact 3.5 SP2 Tried it and no luck. 试了一下,没有运气。 Not sure what to do from here. 不知道从这里做什么。 :\\ :\\

If relevant: Windows XP x32 Visual Studio Professional 2010 SQL server compact 3.5 SP2 如果相关:Windows XP x32 Visual Studio Professional 2010 SQL Server精简版3.5 SP2

Are you using Entity Framework? 您正在使用实体框架吗? If so are you doing Code First or Database First coding? 如果是这样,您是在进行代码优先还是数据库优先编码?

This is an example using MVC3 but is easily transferable to other project models and easy to follow: http://www.asp.net/mvc/tutorials/getting-started-with-aspnet-mvc3/cs/adding-a-model 这是一个使用MVC3的示例,但可以轻松转移到其他项目模型,并且易于遵循: http : //www.asp.net/mvc/tutorials/getting-started-with-aspnet-mvc3/cs/adding-a-model

If you are new to Entity Framework here are some more tutorials to scan through to get what you need: http://www.asp.net/mvc/tutorials/getting-started-with-ef-using-mvc 如果您不熟悉Entity Framework,这里有一些其他教程可以扫描以获取所需的内容: http : //www.asp.net/mvc/tutorials/getting-started-with-ef-using-mvc

Try this link. 试试这个链接。 I just started a ASP.NET web application and I have used this article for setting up some entity framework stuff. 我刚刚启动了ASP.NET Web应用程序,并且已经使用本文设置了一些实体框架。 I really like this so far. 到目前为止,我真的很喜欢。 I hope this helps. 我希望这有帮助。

http://weblogs.asp.net/dotnetstories/archive/2011/03/01/using-stored-procedures-with-entity-framework-in-an-asp-net-application.aspx http://weblogs.asp.net/dotnetstories/archive/2011/03/01/using-stored-procedures-with-entity-framework-in-an-asp-net-application.aspx

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM