IF statement does not work properly

Results 1 to 2 of 2

Thread: IF statement does not work properly

  1. #1
    Join Date
    Dec 1969

    Default IF statement does not work properly

    Hi Guys<BR><BR>Can you tell me what the hell is wrong with this statement<BR>&#060;%<BR> &#039;Declare a SQL string for the SQL query<BR><BR> Dim strSQLCheck<BR> strSqlCheck = "Select app_stage,app_status,usr_usertype From application Inner join users on app_assignedto = usr_username where app_id = &#039;" & AppID & "&#039;"<BR> <BR> &#039;Open Recordset to the Data Source<BR><BR> Dim ObjRsCheck<BR> Set ObjRSCheck = Server.CreateObject ("ADODB.Recordset")<BR> ObjRsCheck.Open strSQLCheck,objConn<BR><BR> If ObjRsCheck("APP_STAGE") = "Inquiry" Then<BR> Response.Redirect "ViewInquiry.asp?strAppID=" & AppID <BR> <BR> Else if ObjRsCheck("APP_STAGE") = "Credit" AND ObjRsCheck("usr_usertype") = 4 Then<BR> Response.Redirect "ViewCredit.asp?AppID=" & AppID<BR> <BR> Else<BR>Response.write "ViewApplication.asp?AppID=" & AppID<BR> End IF<BR>%&#062;<BR><BR>Even though ObjRsCheck("APP_STAGE") equals "Credit" ObjRsCheck("usr_usertype") does not equal to 4, this statement still redirects the page to ViewCredit.asp. It is not taking the condition after "AND" into consideration. Am I using the wrong Syntax here?<BR> <BR>Vik

  2. #2
    Join Date
    Dec 1969

    Default RE: IF statement does not work properly

    Look into ElseIf rather than Else If<BR><BR>and a few Response.Write()s could help determine what&#039;s going on rather than redirecting immediately.

Posting Permissions

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