test if field is null

Discussion in 'ASP .Net' started by Alex, Oct 17, 2003.

  1. Alex

    Alex Guest

    Hi,

    I have the following line in my code
    strSalutation = objReader.GetString(4)

    Now if the field is not null every thing is fine, however if the field is
    null then an error is thrown.

    is it possible to test if objReader is null before I assign it to my
    string.

    cheers

    alex
     
    Alex, Oct 17, 2003
    #1
    1. Advertising

  2. Try IsDBNull method.

    "Alex" <> wrote in message
    news:%...
    > Hi,
    >
    > I have the following line in my code
    > strSalutation = objReader.GetString(4)
    >
    > Now if the field is not null every thing is fine, however if the field is
    > null then an error is thrown.
    >
    > is it possible to test if objReader is null before I assign it to my
    > string.
    >
    > cheers
    >
    > alex
    >
    >
     
    Ali Mazaheri [MCAD], Oct 17, 2003
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    5
    Views:
    26,690
    Mike Schilling
    Mar 29, 2006
  2. Replies:
    6
    Views:
    296
  3. SAN CAZIANO
    Replies:
    1
    Views:
    82
    Michael Winter
    Oct 6, 2004
  4. Sound
    Replies:
    2
    Views:
    451
    Randy Webb
    Sep 28, 2006
  5. jr
    Replies:
    3
    Views:
    424
Loading...

Share This Page