如何将SQL Server数据库转换为.mdf并将其添加到asp.net Web应用程序 [英] How to convert SQL server database to .mdf and add it to asp.net web application

查看:196
本文介绍了如何将SQL Server数据库转换为.mdf并将其添加到asp.net Web应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何将SQL Server数据库转换为.mdf并将其添加到asp.net Web应用程序中?我不会的.

如果要从SQL Server删除数据库,则必须直接对其进行访问.这实际上意味着单用户,因为Jet对多用户而言是相当垃圾-可以在多用户环境中使用它,但它带来的问题多于解决的问题.

由于几乎可以保证Web应用程序是多用户的,因此您将面临很多痛苦.将其保留在SQL Server中,或将其移至MySql-但在没有某种形式的多用户支持的情况下不要尝试使用它!


通常,您不需要如果使用Visual Studio,则创建它.如果使用Visual Studio,则转到Server Explorar.查看那里的Data Connection标记.右键单击它,然后选择Add connection.将出现一个表单,从中可以创建一个新数据库文件(默认为.mdf格式),也可以打开现有的数据库文件(.mdf).然后,您可以使用连接字符串在项目中使用它.


I''d强烈建议不要这样做.让数据库驻留在数据库服务器和SQL Server上,以处理对数据库的所有请求.只需将您的应用程序连接到SQL Server实例即可.

在多用户环境中,您想使用一个为多个客户端同时访问而设计的数据库.


How to convert SQL server database to .mdf and add it to asp.net web application

解决方案

Seriously? I wouldn''t do it.

If you are removing a database from SQL Server, then your access to it has to be direct. Which means in practice single user, as Jet is pretty rubbish at multiuser - it is possible to use it in a multiuser environment but it causes more problems than it solves.

Since a web application is pretty much guaranteed to be multiuser you will be opening yourself up to a world of pain. Keep it in SQL server, or move it to MySql instead - but don''t try to using it without some kind of multiuser support in place!


Normally you don''t need to create it if you use Visual studio.If you use Visual Studio,then go to Server Explorar.See Data Connection tag was there..Right click on it and select Add connection.A form will appear,from there you can create a new database file(which is .mdf format in default) or you can open existing database file(.mdf).Then you can use it in your project by using Connection String.


I''d strongly advice not to do this. Let the database reside on the database server and the SQL Server to handle all the requests to the database. Just connect your application to the SQL Server instance.

In a multi user environment you want to use a database that is designed for several clients accessing it at the same time.


这篇关于如何将SQL Server数据库转换为.mdf并将其添加到asp.net Web应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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