Check presence of Session State

Discussion in 'ASP .Net' started by =?Utf-8?B?S2lt?=, Jan 2, 2006.

  1. I would like to check whether the session object contains dataset before
    retrieving from the data source.

    If NOT CType( Session("ds"), Dataset) = "" Then
    dg.DataSource= ds.Tables("dt")
    dg.DataBind( )
    Else
    ...retrieve from datasource
    End if


    The code above throws back error as dataset is not of String type. I've
    tried other ways of checking this such as replacing the double quote "" with
    "System.Data.Dataset" or "System. Object", etc but all to no avail.

    Anyone can help ?
    =?Utf-8?B?S2lt?=, Jan 2, 2006
    #1
    1. Advertising

  2. If Session("ds") IsNot Nothing Then

    Eliyahu

    "Kim" <> wrote in message
    news:...
    >I would like to check whether the session object contains dataset before
    > retrieving from the data source.
    >
    > If NOT CType( Session("ds"), Dataset) = "" Then
    > dg.DataSource= ds.Tables("dt")
    > dg.DataBind( )
    > Else
    > ...retrieve from datasource
    > End if
    >
    >
    > The code above throws back error as dataset is not of String type. I've
    > tried other ways of checking this such as replacing the double quote ""
    > with
    > "System.Data.Dataset" or "System. Object", etc but all to no avail.
    >
    > Anyone can help ?
    Eliyahu Goldin, Jan 2, 2006
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. shamanthakamani
    Replies:
    1
    Views:
    3,469
    Natty Gur
    Nov 20, 2003
  2. Not Liking Dot Net Today
    Replies:
    0
    Views:
    588
    Not Liking Dot Net Today
    Apr 21, 2004
  3. Fernando Rodriguez
    Replies:
    2
    Views:
    286
    Paul Clinch
    Nov 17, 2003
  4. Maurice LING

    Check for presence fo directory

    Maurice LING, Sep 24, 2004, in forum: Python
    Replies:
    0
    Views:
    348
    Maurice LING
    Sep 24, 2004
  5. Robert Brewer

    RE: Check for presence fo directory

    Robert Brewer, Sep 24, 2004, in forum: Python
    Replies:
    3
    Views:
    259
    Michael Foord
    Sep 24, 2004
Loading...

Share This Page