Can't do Select Case or IF condition from str

Results 1 to 2 of 2

Thread: Can't do Select Case or IF condition from str

  1. #1
    Join Date
    Dec 1969

    Default Can't do Select Case or IF condition from str

    Hi!<BR>I have a problem do Select Case or IF condition when I retrive an assigned CHAR type string data in my SQL database which giving me no result or value matching.<BR>For example: I have one Requisitioner colume which storing user name data in my database&#039;s table with CHAR type. Because I need to retrive this user name data and do Select Case for respective email address, however, I found that the string data retrived from database can not find match in the Select Case (all characters are exactly the same). Even I try to put Cstr() to the database object that I creat or connect, still no result matched from the Select Case. I tried to use integer for assigning the user name, it&#039;s work for the Select Case but not I preffering because inconvenient for referring back the actual user name.<BR>Till that hope someone can tell me what&#039;s wrong there or will it be other way to solve this.

  2. #2
    Join Date
    Dec 1969

    Default RE: Can't do Select Case or IF condition from

    are you saying you&#039;re getting a value from the db and comparing it to a value from a form? they&#039;re equal but the select isn&#039;t working like you&#039;d expect?<BR>if you haven&#039;t already, before your select response.write out the values to verify they are in fact the same. if its a login page and you&#039;re trying to verify correct username and password, i use a differnt technique than a select statement:<BR><BR>sUserID = request.form("uid")<BR>sPass = request.form("pwd")<BR>if (len(sUserID) &#062; 0) then<BR>sSQL = "select password from userTable where userID = &#039;" & sUserID & "&#039;"<BR>...<BR>&#039; execute sql and get recordset<BR>...<BR>if not(rs.eof) then<BR>if (sPass = rs("password")) then<BR>&#039;we got a valid user<BR>&#039;do whatever<BR>else<BR>&#039;found the userID, password didn&#039;t match<BR>end if<BR>else<BR>&#039;did not find userID in DB<BR>end if<BR>end if<BR><BR>this method allows the UserID to be case insensitive, but the password will be case sensitive. don&#039;t know if this is what you&#039;re looking for...<BR><BR>regards<BR>justin

Posting Permissions

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