多个页面需要连接到DB [英] more than one page needs connection to DB

查看:91
本文介绍了多个页面需要连接到DB的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,


我目前正在开发一个项目,需要

维持与整个数据库的连接
$ b用户导航的$ b页面。我已经验证了

我的数据库连接以及启动页面上的一些操作,但我不确定

如何使同样的持续存在
$ b使用C#的其他页面的代码中的$ b。感谢任何帮助。


谢谢,


Carlos。

Hi all,

I am currently working on a project that needs to
maintain the connection to the DB throughout the
pages that the user navigates. I have already validated
my DB connection and some operations on the start-up page, but I am not sure
how to make the same persist
in the code behind for the other pages using C#. I appreciate any help.

Thanks,

Carlos.

推荐答案

您可以在global.asax中的Session_Start事件中创建连接。不过,我很好奇,为什么你需要在整个

会话期间保持连接。这将严重限制您的应用程序的可扩展性。


DalePres

MCAD,MCDBA,MCSE


"卡洛斯" < CH ****** @ yahoo.com>在留言中写道

新闻:%2 **************** @ TK2MSFTNGP15.phx.gbl ...
You can create the connection in your Session_Start event in global.asax. I
am curious, though, why you need to maintain the connection throughout the
session. That will severely limit the scalability of your application.

DalePres
MCAD, MCDBA, MCSE

"Carlos" <ch******@yahoo.com> wrote in message
news:%2****************@TK2MSFTNGP15.phx.gbl...
大家好,

我目前正在开发一个项目,需要在用户导航的整个页面中保持与数据库的连接。我已经在启动页面上验证了我的数据库连接和一些操作,但我并不确定
如何在后面的代码中保持同样的原样
其他使用C#的页面。我感谢任何帮助。

谢谢,

卡洛斯。
Hi all,

I am currently working on a project that needs to
maintain the connection to the DB throughout the
pages that the user navigates. I have already validated
my DB connection and some operations on the start-up page, but I am not
sure
how to make the same persist
in the code behind for the other pages using C#. I appreciate any help.

Thanks,

Carlos.



你可以在global.asax中的Session_Start事件中创建连接。不过,我很好奇,为什么你需要在整个

会话期间保持连接。这将严重限制您的应用程序的可扩展性。


DalePres

MCAD,MCDBA,MCSE


"卡洛斯" < CH ****** @ yahoo.com>在留言中写道

新闻:%2 **************** @ TK2MSFTNGP15.phx.gbl ...
You can create the connection in your Session_Start event in global.asax. I
am curious, though, why you need to maintain the connection throughout the
session. That will severely limit the scalability of your application.

DalePres
MCAD, MCDBA, MCSE

"Carlos" <ch******@yahoo.com> wrote in message
news:%2****************@TK2MSFTNGP15.phx.gbl...
大家好,

我目前正在开发一个项目,需要在用户导航的整个页面中保持与数据库的连接。我已经在启动页面上验证了我的数据库连接和一些操作,但我并不确定
如何在后面的代码中保持同样的原样
其他使用C#的页面。感谢任何帮助。

谢谢,卡洛斯。
Hi all,

I am currently working on a project that needs to
maintain the connection to the DB throughout the
pages that the user navigates. I have already validated
my DB connection and some operations on the start-up page, but I am not
sure
how to make the same persist
in the code behind for the other pages using C#. I appreciate any help.

Thanks,

Carlos.



一个我遗漏了上次回复的内容。创建连接后,

你必须将它保存到一个会话变量。


如果你使用StateServer或SQL Server这不会工作对于会话状态

因为只有可序列化的对象可以在这两个

环境中保持状态。


DalePres


" Carlos" < CH ****** @ yahoo.com>在留言中写道

新闻:%2 **************** @ TK2MSFTNGP15.phx.gbl ...
And one thing I left out of my last reply. After creating the connection,
you will have to save it to a session variable.

This won''t work if you use a StateServer or SQL Server for session state
because only serializable objects can be maintained in state in those two
environments.

DalePres

"Carlos" <ch******@yahoo.com> wrote in message
news:%2****************@TK2MSFTNGP15.phx.gbl...
大家好,

我目前正在开发一个项目,需要在用户导航的整个页面中保持与数据库的连接。我已经在启动页面上验证了我的数据库连接和一些操作,但我并不确定
如何在后面的代码中保持同样的原样
其他使用C#的页面。我感谢任何帮助。

谢谢,卡洛斯。
Hi all,

I am currently working on a project that needs to
maintain the connection to the DB throughout the
pages that the user navigates. I have already validated
my DB connection and some operations on the start-up page, but I am not
sure
how to make the same persist
in the code behind for the other pages using C#. I appreciate any help.

Thanks,

Carlos.



这篇关于多个页面需要连接到DB的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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