What does this mean?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Jason Huang

    What does this mean?

    Hi,

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

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

    Thanks.

    Jason


  • Carlos J. Quintero [.NET MVP]

    #2
    Re: What does this mean?

    Where is "Session" declared? If it is a Web app and the code is in a
    WebForm, which derives from System.Web.UI.P age, 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:
    MZ-Tools has a single goal: To make your everyday programming life easier. As an add-in to several Integrated Development Environment (IDEs) from Microsoft, MZ-Tools adds new menus and toolbars to them that provide many new productivity features.


    "Jason Huang" <JasonHuang8888 @hotmail.com> escribió en el mensaje
    news:uB1Dd$zaFH A.3736@TK2MSFTN GP15.phx.gbl...[color=blue]
    > Hi,
    >
    > Would someone explain the following code more details? Why do we use a
    > Session here?
    >
    > DataSet NowDS=(DataSet) Session["NowDS"]
    >
    > Thanks.
    >
    > Jason
    >[/color]


    Comment

    • Thiru .Net

      #3
      Re: What does this mean?

      hi jason,
      you might have stored some set of data into session and here you are
      retrieving all those values into DataSet....

      rgds,
      thiru

      Comment

      • Frisky

        #4
        Re: What does this mean?

        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" <JasonHuang8888 @hotmail.com> wrote in message
        news:uB1Dd$zaFH A.3736@TK2MSFTN GP15.phx.gbl...[color=blue]
        > Hi,
        >
        > Would someone explain the following code more details? Why do we use a
        > Session here?
        >
        > DataSet NowDS=(DataSet) Session["NowDS"]
        >
        > Thanks.
        >
        > Jason
        >[/color]


        Comment

        Working...