Forum guidelines
AuthorQuestion
Sairam
Then how to assign and read the the Null value in Session variable
Posted By Sairam on 07 Dec 2011
I want to read a DB data and put into session and then need to read the session value and insert into another Table..

Issue i am facing here is

First time wen reading value frm DB ., if any fields contains NULL ., then how to assign and read the the Null value in Session variable 




AuthorReply
Re: Then how to assign and read the the Null value in Session variable
Posted By Jignesh Trivedi on 02 Jan 2012  
Hi,

use IsDBNull when retrive from database and set initial value.

In vb

if(IsDBNull(dr(0)))
       Session("test") = 0;
end

in C#

if(string.IsNullOrEmpty(StringValue))

{

Session["test"] = 0;

}

hope this help..



Download Free eBooks

SPONSORED BY

Spire.Doc - Free .NET Word API
Use Spire.Doc to create, read, write, print, and convert word documents to OpenXML, RTF, TXT, XPS, EPUB, EMF, HTML, Image and PDF.