#1
  1. No Profile Picture
    Contributing User
    ASP Explorer (0 - 99 posts)

    Join Date
    Sep 2005
    Location
    Georgia
    Posts
    31
    Rep Power
    10

    If Then statement with Null Value


    Does anyone know how to write the following statement correctly.

    If [FieldName] is Null Then [DoThis]

    In VBA it was - If IsNull(FieldName) Then [Do This]

    Thanks
  2. #2
  3. Contributing User
    ASP High Scholar (3500 - 3999 posts)

    Join Date
    Mar 2006
    Location
    South Wales
    Posts
    3,674
    Rep Power
    2043
    What happens when you use that logic, do you get an error?

    What version of VB are you using? In VB6 your syntax is fine:
    Code:
    If IsNull(rs.Fields(0)) Then
         'the field is null!!
    End If
    If you are using .Net I think the command has been replaced with IsDBNull:
    Code:
    If IsDBNull(myDataSet.Tables(0).Item(0)) Then
         'the field is null!!
    End If
    Last edited by sync_or_swim; March 20th, 2008 at 06:13 AM.
  4. #3
  5. No Profile Picture
    Registered User
    ASP Explorer (0 - 99 posts)

    Join Date
    Apr 2008
    Posts
    3
    Rep Power
    0
    Code:
    if (field name).lenght > 1 then
    this may not be 100% correct but close very close

Similar Threads

  1. Insert Statement Table
    By desireemm in forum SQL Development
    Replies: 4
    Last Post: April 11th, 2007, 06:41 PM
  2. Query Error - Text Too Long
    By navkeshchawla in forum Microsoft Access Help
    Replies: 8
    Last Post: June 20th, 2006, 08:07 AM
  3. Compare two tables
    By aish in forum Microsoft SQL Server
    Replies: 3
    Last Post: January 27th, 2006, 08:42 AM
  4. Addition Woes
    By Jackie W in forum ASP Development
    Replies: 19
    Last Post: April 29th, 2005, 01:30 PM
  5. ASP Problem When Posting To MySQL Database
    By wleguy in forum ASP Development
    Replies: 14
    Last Post: February 22nd, 2004, 12:49 PM

IMN logo majestic logo threadwatch logo seochat tools logo