Results 1 to 2 of 2
  1. #1
    Join Date
    Dec 2002
    Location
    KY
    Posts
    56

    Exclamation Unanswered: I'm having a problem using if statements in ASP

    can someone show me what i'm doing wrong. I'm trying to if statements to get past NULL values.

    PLEASE HELP!!!!!!

    Dim strSQL, rs1, rs2, rsInsert, newID

    strSQL = "Select * From Temp_tblContractor_Import"
    set rs1 = objConn.Execute(strSQL)

    Do While NOT rs1.EOF

    If (Is Null rs1("Business_Name")) = "False" then
    Business_Name = rs1("Business_Name")
    End if

    strSQL = "Insert INTO HBC_Contact (Fname, Lname, Business_Name, Address1, City, Zip, Phone1) "
    strSQL = strSQL & "VALUES ('" & replace(rs1("FName"), "'", "''")& "', '" & replace(rs1("LName"), "'", "''") & "', "
    strSQL = strSQL & "'" & replace(rs1("Business_Name"), "'", "''")& "', '" & replace(rs1("Address"), "'", "''") & "', "
    strSQL = strSQL & "'" & replace(rs1("City"), "'", "''")& "', '" & replace(rs1("Zip"), "'", "''") & "', "
    strSQL = strSQL & "'" & replace(rs1("Phone_No"), "'", "''")& "');"
    strSQL = strSQL & "select @@identity"
    set rsInsert = objconn.execute(strSQL).nextrecordset

    newID = rsInsert(0)

    strSQL = "Insert Into HBC_License_Holder (Contractor_No, Contact_ID) "
    strSQL = strSQL & "VALUES ('" & rs1("Contractor_No") & "'," & newID & ");"

    'objConn.Execute(strSQL)

    rs1.MoveNext()
    Loop

  2. #2
    Join Date
    Jan 2003
    Location
    Midwest
    Posts
    138
    try

    If NOT (isNull(rs1("Business_Name"))) then Business_Name = rs1("Business_Name")

    OR

    If(isNull(rs1("Business_Name"))) then
    Business_Name = ""
    else
    Business_Name = rs1("Business_Name")
    end if

    either one should do the trick.

Posting Permissions

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