469,890 Members | 2,363 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,890 developers. It's quick & easy.

how check if session is null?

HI all how dya check if session is null or does not exist?

I tried using

if Session("cart")= null then
...
end if

this doesn't work it says 'null' is not declared. 'null' constant is no
longer supported. use 'system.dbnull' instead.

then when i use system.dbnull it says 'system.dbnull' is an object cannot
be used as an expression.

:( how to check this?
Thanks

--
Message posted via http://www.dotnetmonster.com
Nov 19 '05 #1
1 6393
lydia sista via DotNetMonster.com wrote:
HI all how dya check if session is null or does not exist?

I tried using

if Session("cart")= null then
..
end if

this doesn't work it says 'null' is not declared. 'null' constant is no
longer supported. use 'system.dbnull' instead.

then when i use system.dbnull it says 'system.dbnull' is an object cannot
be used as an expression.

:( how to check this?
Thanks


"null" is C#, DbNull.Value is the .Net representation of a database
(sql) null. In VB you want "Nothing".

I'm not sure about the VB syntax (I use C#) but try:
If Session("cart") Is Nothing Then ..
If IsNothing(Session("cart")) Then ..

--
Hans Kesting
Nov 19 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

5 posts views Thread by Anthony Robinson | last post: by
5 posts views Thread by LL | last post: by
reply views Thread by Tim T | last post: by
3 posts views Thread by rony_16 | last post: by
4 posts views Thread by Simon Gare | last post: by
2 posts views Thread by =?Utf-8?B?VmxhZCBIcnlib2s=?= | last post: by
1 post views Thread by Waqarahmed | last post: by
reply views Thread by Salome Sato | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.