If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > ASP > I'm having a problem using if statements in ASP

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 02-06-03, 14:01
Bigced_21 Bigced_21 is offline
Registered User
 
Join Date: Dec 2002
Location: KY
Posts: 54
Exclamation 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
Reply With Quote
  #2 (permalink)  
Old 02-06-03, 16:52
Memnoch1207 Memnoch1207 is offline
Registered User
 
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.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On