How to find if a value is null

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Jiten

    How to find if a value is null

    Hi

    I have run a stored proc against a database to retrieve a list of date values. What i wanted to do is to add the values returned to an arraylist if the value is not null.

    here is a small portion of my code that i am using...

    Tr
    MyConn.Open(
    Dim rdr As SqlDataReade
    rdr = SPretDate.Execu teReader(
    rdr.Read(
    Dim FlightDate As String = (rdr.GetSqlDate Time(0).ToStrin g

    'if flightDate is not Null the
    FlightDateArray List.Add(Flight Date
    'End i

    I also wanted to minus 1 date from another to get the number of days gap
    i.e in Psedo code...
    daysGap = FlightDate - Flightdate

    Im also stuck on how to achieve this. Can anyone offer any assistance
    many th

  • Scott M.

    #2
    Re: How to find if a value is null

    if Not IsDBNull(flight Date) then
    FlightDateArray List.Add(Flight Date )
    End if


    I also wanted to minus 1 date from another to get the number of days gap.
    daysGap = FlightDate.subt ract(Flightdate 2)



    "Jiten" <anonymous@disc ussions.microso ft.com> wrote in message
    news:99EB8F45-C375-49CE-BEBB-205917979BBA@mi crosoft.com...[color=blue]
    > Hi,
    >
    > I have run a stored proc against a database to retrieve a list of date[/color]
    values. What i wanted to do is to add the values returned to an arraylist if
    the value is not null.[color=blue]
    >
    > here is a small portion of my code that i am using....
    >
    > Try
    > MyConn.Open()
    > Dim rdr As SqlDataReader
    > rdr = SPretDate.Execu teReader()
    > rdr.Read()
    > Dim FlightDate As String =[/color]
    (rdr.GetSqlDate Time(0).ToStrin g)[color=blue]
    >
    > 'if flightDate is not Null then
    > FlightDateArray List.Add(Flight Date )
    > 'End if
    >
    >
    > I also wanted to minus 1 date from another to get the number of days gap.
    > i.e in Psedo code....
    > daysGap = FlightDate - Flightdate2
    >
    > Im also stuck on how to achieve this. Can anyone offer any assistance?
    > many thx
    >[/color]


    Comment

    Working...