Notices

Great community. Great ideas.

Welcome to ASP/Free, a community dedicated to helping beginners and professionals alike in improving their knowledge of Microsoft's development and administration technologies. Sign up today to gain access to the combined insight of tens of thousands of members.

Thread: If Then statement with Null Value

Results 1 to 3 of 3
Share This Thread →
  1. #1
    Datary is offline Contributing User
    Join Date
    Sep 2005
    Location
    Georgia
    Posts
    31
    Rep Power
    9

    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
    sync_or_swim's Avatar
    sync_or_swim is offline Contributing User
    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 05:13 AM.

  3. #3
    swalker1595 is offline Registered User
    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

Share This Thread →

Become Part of This Conversation

Join NowFor Free!

Similar Threads

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

ASP Free Advertisers and Affiliates