473,386 Members | 1,908 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

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 7839
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Anthony Robinson | last post by:
Consider the following tables: CREATE TABLE "AIMD "."CHANNELSESSION" ( "CHANNELSESSIONID" DECIMAL(13,0) NOT NULL GENERATED ALWAYS AS IDENTITY ( START WITH +1 , INCREMENT BY +1 , CACHE 20 ) ,...
5
by: LL | last post by:
Hi, Where is the best place to check the session's object, if it's null, then redirect the user to login page? put into every page's load event? Thanks.
0
by: Tim T | last post by:
Hi, I have a web application that has a number of users who administer their own data... i have several pages that check to see if a valid userID session exists, and if not, send them to a...
3
by: rony_16 | last post by:
hi , i want to override the object session in class page , because i want to check the Session automaticly in WebForm , without writing "if" in evry page . i know that i need to make a new...
10
by: Mark Rae | last post by:
Hi, This relates to the previous thread "Disappearing Sessions", but is a bit more generic so I thought I'd start a new thread. This one relates to the storing of objects in Session once only to...
2
by: Athenian | last post by:
Hi guys. Currently I need a javascript (client side) or vbscript(server side) code to check automatically for session expiration and force the redirection to a message page or the log-in page....
4
by: Simon Gare | last post by:
Hi all, below is an insert statement on an asp page that stores the date and time that a driver logged on, what I need is to check that they are now already logged on fields are SQL Server...
0
by: readnlearn | last post by:
hai, i have written this below code for displaying captcha image whenever i entered incorrect uname,password in login page. for that i disable the controls of captcha like textbox,labels,button and...
2
by: =?Utf-8?B?VmxhZCBIcnlib2s=?= | last post by:
This one should be simple, but I can't find the answer in MSDN. There are cases when it's necessary for controls, master pages and other reusable units of code-behind to determine at run time...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.