How can set case sensitive in the login form

Posted by Sekar.C under C# on 4/18/2012 | Points: 10 | Views : 8075 | Status : [Member] | Replies : 4
Hi,
Using c# windows application
I stored user name(Sample) and password (AAAAA)in sqlserver through register form
But I put name(sample) and Password(aaaaa) in the login form it move to next form
How can set case sensitive in the login form give the code
Regards
Sekar.c

Regards
Sekar.c



Responses

Posted by: Gsm_Gsv on: 4/18/2012 [Member] Starter | Points: 25

Up
0
Down
For case sensitive comparison use STRCOMP() function

Example:
CmdString =("Select username, password from UserInfo Where

STRCOMP(username,@uname,0)=0 AND STRCOMP(password,@Password,0)=0")


The third parameter in STRCOMP can be 0,1,2
0 means binary compare so
it will be a case sensitive match. Return of 0 means the first two
parameters are equal.


---------------------------------------
Live the life you've dreamed

Regards
MADHU

Sekar.C, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Sakthi.Singaravel on: 4/18/2012 [Member] Silver | Points: 25

Up
0
Down
use ur code like these..

If Password_TextBox.Text.Equals("AAAAA", StringComparison.CurrentCultureIgnoreCase) Then
// Ur operation


Regards,
Singaravel M

Sekar.C, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Sakthi.Singaravel on: 4/18/2012 [Member] Silver | Points: 25

Up
0
Down
string temp_password=//query for get from ur database

If String.Compare(temp_password, Password_txtbox.Text, False) Then
MessageBox.Show("Match")
Else
MessageBox.Show("No Match")
End If

Regards,
Singaravel M

Sekar.C, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Sekar.C on: 5/7/2012 [Member] Starter | Points: 25

Up
0
Down
use this code
com = new SqlCommand("Select Name, Password from login Where Name ='" + textBox1.Text + "'COLLATE SQL_Latin1_General_Cp1_CS_AS and Password='" + textBox2.Text + "'COLLATE SQL_Latin1_General_Cp1_CS_AS", con);


Regards
Sekar.c

Sekar.C, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response