从Web应用程序连接到SQL Server 2008 R2数据库 [英] Connect to a sql server 2008 R2 database from a web application

查看:247
本文介绍了从Web应用程序连接到SQL Server 2008 R2数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,



我有一个asp.net Web应用程序和一个sql server 2008 R2数据库。该应用程序同时被超过300个用户使用,它们同时检索,添加,更新和删除记录。应用程序在执行查询的每个函数处打开和关闭连接。

我认为在所有这些时间打开和关闭连接以及使用该数量的用户是错误的吗?但我不知道如何让这更好,因为我是asp.net的新手,所以有人可以帮助我并给我一些更好的想法吗?



提前谢谢。

Hi all,

I have an asp.net web application and a sql server 2008 R2 database. the application is being used by over than 300 users in the same time, they are retrieving, adding, updating and deleting records simultaneously. The application is opening and closing the connection at each function that executes a query.
I think its wrong to open and close connection for all these times and with that number of users right? but i don''t know how to make this better because i''m new with asp.net so can anyone help me and provide me with some better ideas?

Thanks in advance.

推荐答案

据我所知,打开和关闭连接没有任何问题。在需要时打开它,并在完成后立即关闭它。连接池将自动处理重用连接。



http://msdn.microsoft.com/en-us/library/8xx3tyca(v = vs.90).aspx [ ^ ]
As far as I know, there is no any issues with opening and closing the connection. Open it when you need it and close it as soon as you''re done with it. Connection pooling will automatically handle the reusing the connection.

http://msdn.microsoft.com/en-us/library/8xx3tyca(v=vs.90).aspx[^]


这篇关于从Web应用程序连接到SQL Server 2008 R2数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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