Select case

Results 1 to 2 of 2

Thread: Select case

  1. #1
    Join Date
    Dec 1969

    Default Select case

    I am using select case in asp to select one out of two option, the weird thing is that it always select the second case although the "if statement" tells it to select the first case. Can someone help me? Thanks.<BR>Let assume that I open the connection, and the recordset to select "LastName" in my database. "LastName" is just a field in this database. I want to compare this lastname with the Logon_user id. If it&#039s true, then select the first case, else select the second case. Unfortunately, it only select the first case while the lastname is equals to the logon_user id. Here is the code.<BR><BR>dim id<BR><BR>if session(LCase("LOGON_USER")) = LCase(objRS.Fields("LastName") then id = 1 <BR>else id = 2<BR>end if<BR><BR>select case id<BR> case "1"<BR> response.write "first case"<BR> case "2"<BR> response.write "second case"<BR>end select<BR><BR>Please help. Thanks.<BR>

  2. #2
    Join Date
    Dec 1969

    Default RE: Select case

    You need to use debugging to determine the reason why this is happening and where it is happening so<BR><BR>dim id<BR><BR>Response.write "val1:" & session(LCase("LOGON_USER")) & "<BR>"<BR>response.write "val2:" & LCase(objRS.Fields("LastName")<BR><BR>if session(LCase("LOGON_USER")) = LCase(objRS.Fields("LastName") then id = 1 <BR>else id = 2<BR>end if<BR><BR>Response.write "val3:" & id<BR>select case id<BR>case "1"<BR>response.write "first case"<BR>case "2"<BR>response.write "second case"<BR>end select<BR><BR>You&#039ll find it easier to find a problem using debugging because by looking at your code I think that we can only speculate as to what you are actually doing.<BR><BR>Hope you find your problem<BR><BR>

Posting Permissions

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