Translated literally from C#:
Declare a DataSet object reference names NowDS.
Set NowDS to the value in the you Session object named "NowDS".
If the named object does not exist in the session, you will get a null back.
Which means if you use the reference without checking it for null you will
get an exception. The DataSet would have to have been placed in the session
by code that executed earlier in the program. Like on another page. A
session is tied to a specific user too, so it would have to be the same user
and instance for the session to be the same.
BTW: It is not a good programming practice to stuff DataSets (especially
large DataSets) in the session.
Hope this helps...
Frisky
"Jason Huang" <Ja************@hotmail.com> wrote in message
news:uB**************@TK2MSFTNGP15.phx.gbl...
Hi,
Would someone explain the following code more details? Why do we use a
Session here?
DataSet NowDS=(DataSet)Session["NowDS"]
Thanks.
Jason