会话状态问题 [英] Session state problem

查看:81
本文介绍了会话状态问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个特殊的问题。我有一个简单的Web应用程序,从oracle表中加载一些数据,并在

网页的datagrid中显示,datagrid已启用页面,在页面上显示10行.I

有一个搜索条件来根据数据范围搜索记录我



这就是我所做的,在!IsPostBack部分。我正在设置

oracle连接,创建数据集对象,datadapter和我aslo

将数据库中的数据加载到数据集中并移动所有数据集,

datadapter,以及会话对象的连接对象。现在用户可以用记录进行不同的操作,比如他从网格中选择一行并且

网格列中有按钮进行更新,所以我这样做,

更新该特定行的数据集对象,然后当下一次调用时间页加载时,我调用dataadapter.update来更新数据

回到数据库。所以我的dataproviders对象存储在

会话对象中。首先,它是一个很好的方法吗?


会话结束时的第二个,如果用户回来并做了一些

操作,它无法更新,因为会话变量

被销毁,并且会产生错误。我该怎么做才能解决这个问题?
这个问题?或者如果会话对象不是存储这个

dataprovider对象的好地方,那我应该存储哪些?我的页面没有

用户登录,我只是使用asp.net创建的默认会话。

请帮帮我,非常紧急
venky

解决方案

>首先,它是一个很好的方法吗?


我们可以在那里停下来,因为不,这不是一个好方法。它听起来像是来自ASP背景,其中连接池

不是平台的一部分。使用ASP.Net,最好打开并尽快关闭你的Connections,然后将它们释放回

池。


-

HTH,

Kevin Spencer

..Net开发人员

Microsoft MVP

大件东西组成

很多小东西。


Venkat Chellam <已经************ @ yahoo.com>在消息中写道

news:ac ************************** @ posting.google.c om ...

我有一个特殊的问题。我有一个简单的Web应用程序,它从oracle表中加载一些数据并显示在
网页的datagrid中,datagrid已启用页面,在页面上显示10行。我有一个根据数据范围搜索记录的搜索条件我将给出

这就是我在!IsPostBack部分所做的工作。我正在设置oracle连接,创建数据集对象,datadapter以及我将数据从数据库加载到数据集中,并将所有数据集,数据适配器和连接对象移动到会话对象。现在用户可以对记录进行不同的操作,比如他从网格中选择一行,然后在网格的列中有按钮进行更新,所以我做了什么,
更新数据集对象对于那个特定的行,然后当下一个
时间页面加载被调用时,我调用dataadapter.update来将数据更新回数据库。所以我的dataproviders对象存储在
会话对象中。首先,它是一个很好的方法吗?

第二次会话结束,如果用户回来并做了一些操作,它会因为会话而无法更新变量
被破坏,它会产生错误。我该怎么做才能解决这个问题?或者,如果会话对象不是存储此
dataprovider对象的好地方,那么我应该存储哪些?我的页面没有
用户登录,我只是使用asp.net创建的默认会话。
请帮助我,非常紧急

venky






感谢您的回复。你能更多地阐述我想做的事情吗?我

也没用过asp,这是我第一次使用

一些webapplication。


你能告诉我吗?我更详细的我想做什么或一些样品

代码?

venky


***通过Developersdex发送 http://www.developersdex.com ***

不要只是参加USENET ......获得奖励!


精心制作?好吧,当你想使用你的数据库时,打开一个

连接,做你的工作,然后立即关闭它。


你可能想创建一个每当您需要连接到数据库时,您可以使用的静态数据库实用程序函数类。我相信微软

可以提供其中一些,虽然我不知道在哪里(我自己写的)。

希望这里的其他人可以告诉你。


-

HTH,

Kevin Spencer

..Net开发人员

微软MVP

大件东西组成

很多小东西。


" venkat chellam" <已经************ @ yahoo.com>在消息中写道

news:uv ************** @ TK2MSFTNGP10.phx.gbl ...


<感谢您的回复。你能更多地阐述我想做的事情吗?我也从未在asp上工作过,这是我第一次使用
一些webapplication。

你能告诉我更多我想做的事情或者一些事情吗?样品
代码?

venky

***通过Developersdex发送 http://www.developersdex.com ***
不要只是参加USENET ......获得奖励!



I have a peculiar problem. I have a simple web application which loads
some data from the oracle table and display in the datagrid in the
webpage and datagrid has page enabled which shows 10 rows at a page.I
have a search criteria to search the records based on the data range i
give
This is what i have done, in the !IsPostBack section. I am setting up
the oracle connection, creating dataset object, datadapter and i aslo
load the data from the database into dataset and move all dataset,
datadapter, and connection object to session object. Now user can do
different operations withe records, like he select a row from grid and
there is button on in column of the grid to update , so what i do ,
update the dataset object for that particular row and then when next
time page load is called, i call dataadapter.update to update the data
back to the database. so my dataproviders objects are stored in the
session object. First of all is it a good way to do this?

Second when the session ends, and if the user comes back and does some
operation, it going to fail to update because the session variables
are destroyed and it will generate an error. What should i do to solve
this problem? Or if session object is not a good place to store this
dataprovider object, where shoould i store?. My page doesn''t have a
user login, i am just using the default session created by asp.net.
Please help me, its very urgent
venky

解决方案

> First of all is it a good way to do this?

We can stop right there, because no, it is not a good way to do this. It
sounds like you''re coming from an ASP background, where Connection Pooling
was not part of the platform. With ASP.Net, your best bet is to open and
close your Connections as quickly as possible, to release them back into the
pool.

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.

"Venkat Chellam" <ve************@yahoo.com> wrote in message
news:ac**************************@posting.google.c om...

I have a peculiar problem. I have a simple web application which loads
some data from the oracle table and display in the datagrid in the
webpage and datagrid has page enabled which shows 10 rows at a page.I
have a search criteria to search the records based on the data range i
give
This is what i have done, in the !IsPostBack section. I am setting up
the oracle connection, creating dataset object, datadapter and i aslo
load the data from the database into dataset and move all dataset,
datadapter, and connection object to session object. Now user can do
different operations withe records, like he select a row from grid and
there is button on in column of the grid to update , so what i do ,
update the dataset object for that particular row and then when next
time page load is called, i call dataadapter.update to update the data
back to the database. so my dataproviders objects are stored in the
session object. First of all is it a good way to do this?

Second when the session ends, and if the user comes back and does some
operation, it going to fail to update because the session variables
are destroyed and it will generate an error. What should i do to solve
this problem? Or if session object is not a good place to store this
dataprovider object, where shoould i store?. My page doesn''t have a
user login, i am just using the default session created by asp.net.
Please help me, its very urgent
venky





Thanks for replying. Can you eloborate more what i am suppose to do? I
never worked on asp either, this is the first time i am working with
some webapplication.

can you tell me more in detail what ia m suppose to do or some sample
code?
venky

*** Sent via Developersdex http://www.developersdex.com ***
Don''t just participate in USENET...get rewarded for it!


Elaborate? Well, when you want to work with your database, open a
Connection, do your work, and close it immediately.

You may want to create a class of static database utility functions that you
can use whenever you need to connect to your database. I believe Microsoft
makes some of these available, although I''m not sure where (I wrote my own).
Hopefully, someone else here can tell you that.

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.

"venkat chellam" <ve************@yahoo.com> wrote in message
news:uv**************@TK2MSFTNGP10.phx.gbl...



Thanks for replying. Can you eloborate more what i am suppose to do? I
never worked on asp either, this is the first time i am working with
some webapplication.

can you tell me more in detail what ia m suppose to do or some sample
code?
venky

*** Sent via Developersdex http://www.developersdex.com ***
Don''t just participate in USENET...get rewarded for it!



这篇关于会话状态问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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