C# uses "null".
VB uses "Nothing".
Try
If IsNothing(Session("Source")) Then
....rest of code
End If
You could also set a variable equal to Session("Source")
and then the code would look a bit cleaner :
Dim varSource as String=Session("Source")
If IsNothing(varSource) Then
....rest of code
End If
Juan T. Llibre
ASP.NET MVP
http://asp.net.do/foros/
Foros de ASP.NET en Español
Ven, y hablemos de ASP.NET...
======================
"simon" <si*********@stud-moderna.si> wrote in message
news:Ok**************@TK2MSFTNGP12.phx.gbl...
Hi Michael,
If I use Session[''aaa'] =null I get the following error message:
'null' is not declared. 'Null' costant is no longer suported; use
'System.DBNull' instead.
So, that's way I'm using DBNull.
By the way, I'm writing in VB language. I heard that in C# that is
possible, to compare with null value.
Any comment?
Regards,
Simon
"Michael Tkachev" <m_*******@hotmail.com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl... Hi,
Why do you check your session for DBNull???
DBNull is just for a database.
if(Session[''aaa'] == null)
just like that
bye
"simon" <si*********@stud-moderna.si> wrote in message
news:e4*************@TK2MSFTNGP12.phx.gbl... I use session:
If IsDBNull(Session("Source")) Then ' this is the line cause an error
bindRptSell()
End If
But I get an error message:
Object variable or With block variable not set.
System.NullReferenceException: Object variable or With block variable
not
set.
Why? I check for null.
Simon