-
Is it possible to make a SELECT statment case-sensitive? For example, is it possible to have a statment like
Code:
rsCountry.Open "Select * From Countries Where COUNTRY = '" & txtCountry.text & "'", myCN, adOpenKeyset, adLockReadOnly
where, if txtCountry.text = 'France', the recordset would return 'France' but not 'FRANCE'?
-
Yes there is.
You need to compare the ACTUAL values of the characters rather than the symbolic fact of what letter it is.
Therefor you need to convert the things you are comparing to a variable length BINARY field (The equivalent of comparing actual ASCII values instead of letters)
Code:
rsCountry.Open "Select * From Countries Where CONVERT(varbinary,COUNTRY) = CONVERT(varbinary,'" & txtCountry.text & "')", myCN, adOpenKeyset, adLockReadOnly
-
Gen-X, I tried your example. The recordset is actually a table of previously used passwords, so the recordset looks like:
Code:
rsPasswords.Open "Select * From Passwords Where IdUSUARIO = " & _
rsUsers.Fields("IdUSER").Value & " And CONVERT(varbinary, PASSWORD) = CONVERT(varbinary, '" & _
txtPassword(1).Text & "')", myCN, adOpenKeyset, adLockReadOnly
But it gives me the error that the function CONVERT is not defined in the expression.
-
Sounds like you are not using SQL Server but perhaps Access or something else.
In that case you have to find a similar function in the SQL help of the database you are using that allows you to convert between datatypes.
You want to get away from strings and into a format that is binary in nature so that you compre the actual values and not the string "logical" values.
-
YOu are right, I am using Access. There is probably some similiar function in Access, though, so I will check the Help sections.