Click here to Skip to main content
Rate this: bad
Please Sign up or sign in to vote.
See more: C#
i have made a insert query used as registration and select query as login and checking but the problem is. it doesnt check for upper case how can i put that in my small scale app.
Posted 14-Nov-12 10:38am
Edited 16-Dec-12 18:01pm
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

You need to tell SQL to use a collation that is case sensitive.
Do this in your SQL:
WHERE password = @password COLLATE SQL_Latin1_General_CP1_CS_AS and Username=@Username
That tells SQL to treat "password = @password" with case sensitivity.
sariqkhan at 14-Nov-12 16:58pm
nice one +5 but how do you do that? whats the concept behind that? what is this COLLATE SQL_Latin1_General_CP1_CS_AS? i never heard before
ryanb31 at 14-Nov-12 17:01pm
Collation defines how dates are stored, how strings are sorted (for example does 9AA come before or after AA) etc. It's kind of like a culture setting. If you look at the properties for your SQL database you'll see what the collation is set to. So, in this case, we're just overriding the collation to make it case sensitive. I actually worked on a DB once that had a case sensitive collation on the whole db. It was terrible. You had to have the case for field names correct or it could not find them.
shaikh-adil at 14-Nov-12 17:00pm
sariqkhan at 14-Nov-12 19:14pm
nice explanation bro thanx for helping
RaisKazi at 14-Nov-12 19:47pm
My 5+
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

For SQL you can use COLLATE.[^].
Here is an example link[^] for you.
Good luck,
shaikh-adil at 14-Nov-12 17:00pm
RaisKazi at 14-Nov-12 19:47pm
My 5!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Your Filters
0 Guruprasad.K.Basavaraju 390
1 Sergey Alexandrovich Kryukov 266
2 Shai Vashdi 220
3 OriginalGriff 153
4 Tadit Dash 135
0 Sergey Alexandrovich Kryukov 9,255
1 OriginalGriff 5,433
2 Peter Leow 4,100
3 Maciej Los 3,540
4 Abhinav S 3,333

Advertise | Privacy | Mobile
Web03 | 2.8.140415.2 | Last Updated 17 Dec 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Use
Layout: fixed | fluid