how check if session is null?

  • Thread starter lydia sista via DotNetMonster.com
  • Start date
L

lydia sista via DotNetMonster.com

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
 
H

Hans Kesting

lydia said:
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 ..
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,584
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top