Results 1 to 2 of 2

Thread: condition

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Dec 2002
    Location
    London
    Posts
    678

    condition

    I would like to check for a field if it is null so that I don't get an error while populating data.
    This is what I am using. It does not work. Can u c why please? thanks
    lblArrivaltime.Text = (oDR["ArrivalTime"].ToString() == null) ? "" : oDR["ArrivalTime"].ToString();

  2. #2
    Frenzied Member Memnoch1207's Avatar
    Join Date
    Feb 2002
    Location
    DUH, Guess...Hint: It's really hot!
    Posts
    1,861
    VB:
    VB Code:
    1. If Not IsDBNull(dr("FieldName") then
    2.    Variable = dr("FieldName").ToString()
    3. End If

    CSharp:
    Code:
    if (!dr.IsNull("FieldName")
    { 
       Variable = dr["FieldName"].ToString(); 
    }
    Being educated does not make you intelligent.

    Need a weekend getaway??? Come Visit

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width