What does this mean?

  • Thread starter Thread starter Jason Huang
  • Start date Start date
J

Jason Huang

Hi,

Would someone explain the following code more details? Why do we use a
Session here?

DataSet NowDS=(DataSet)Session["NowDS"]

Thanks.

Jason
 
Where is "Session" declared? If it is a Web app and the code is in a
WebForm, which derives from System.Web.UI.Page, it may refer to the
Page.Session object, that can hold values for the current web visitor...

--

Best regards,

Carlos J. Quintero

MZ-Tools: Productivity add-ins for Visual Studio .NET, VB6, VB5 and VBA
You can code, design and document much faster.
Free resources for add-in developers:
http://www.mztools.com
 
hi jason,
you might have stored some set of data into session and here you are
retrieving all those values into DataSet....

rgds,
thiru
 
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
 
Back
Top