与Web应用程序的sql连接. c#.net,asp.net [英] sql connection with web application. c#.net, asp.net

查看:153
本文介绍了与Web应用程序的sql连接. c#.net,asp.net的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有关与Web应用程序的sql数据库文件连接的查询.在C#.net-asp.net中,如果我开发一个Web应用程序,那么我需要连接sql数据库,有两种方法可以连接它.

1.将数据库附加到sql server.在webconfig文件的连接字符串中提供ID,密码和服务器ip.

2.将sql数据库文件放在App_Data文件夹中,并在连接字符串中给出sql数据库文件的路径.

哪个更好,为什么?
两种方法之间的区别?
(Web应用程序的性能是否受到第二种方法的影响)?

My query regarding sql database file connection with web application. In C#.net-asp.net , if I develop a web application then i need to connect sql database, there are two method to connect it .

1. attach database to sql server. Give id, password and server ip in connection string in webconfig file.

2. put the sql database file in App_Data folder, and in connection string give the path of sql database file.

Which one is better and why?
Difference Between both method?
(is performance of web application is effected or not in 2nd method)?

推荐答案

出于开发目的,您可以使用App_Data DB(SQL Express).对此有很多限制:
1.仅支持CPU 1.
2.如果用户数量增加,性能会受到影响.
3.如果要托管这样的应用程序,则总体否定.

如果您的模型是使用SQL Express在本地开发的,则将数据库从App_Data文件夹中移至完整的SQL Server实例(我的意思是附加到SQL Server).
For development purpose you may go with App_Data DB(SQL Express). Lot of limitation to this:
1. CPU support is only 1.
2. Performance hit if the number of users increases.
3. Overall negative if you want to host an app like this.

if your model is to develop locally using SQL express, then take the DB from your App_Data folder to a full SQL server instance(I mean attach to SQL Server).


这篇关于与Web应用程序的sql连接. c#.net,asp.net的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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