Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > SQL Server > SQL Server 2000 > SQL Server 2000
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
SQL Server 2000 General discussion of Microsoft SQL Server -- for topics that don't fit in one of the more specific SQL Server forums. version 2000 only. There's a new forum for SQL Server 2005.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the SQL Server 2000 section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old September 29th, 2007, 05:58 AM
Authorized User
 
Join Date: Nov 2005
Location: Colombo, , Sri Lanka.
Posts: 51
Thanks: 0
Thanked 0 Times in 0 Posts
Default User Name, Password Case sensetive

hi all,
I have big problem to check login user username and password case sensetive.
im doing asp.net(c#) website using sqlserver 2000 database. I tried to check user name casesensitive. But it isnt check and only checking all word. If My User name and database finding record is true then user can log to sytem. But i want to check also UserName is casesensitive or not.
Can anybody help me to do this thing...
Thank you
__________________
MSB
Reply With Quote
  #2 (permalink)  
Old September 29th, 2007, 09:00 AM
joefawcett's Avatar
Wrox Author
Points: 9,763, Level: 42
Points: 9,763, Level: 42 Points: 9,763, Level: 42 Points: 9,763, Level: 42
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Exeter, , United Kingdom.
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

If you are testing within a stored procedure then you can use a case-sensitive collation, this fragment is from one I wrote where @Password is what was entered and @CurrentPassword is what is held in the table:
Code:
IF @CurrentPassword = @Password COLLATE SQL_Latin1_General_CP1_CS_AS RETURN 0;
  RETURN 1;

In this stored procedure 0 returned means valid, 1 means failed.

If you are testing within your C# code then you can use string.Compare but pass false for the third parameter, ignoreCase.

--

Joe (Microsoft MVP - XML)
Reply With Quote
  #3 (permalink)  
Old October 1st, 2007, 01:21 AM
Authorized User
 
Join Date: Nov 2005
Location: Colombo, , Sri Lanka.
Posts: 51
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hello joefawcett,

Can understand what you said. But i tried to apply it. Cant do it to me. This is my SP, Please help me to modify it joefawcett.

CREATE PROCEDURE [dbo].[SEARCH_USERLOGING_STATUS]
    @Usr_Name varchar(100),
    @Usr_Password varchar(50),
    @Usr_Macaddress varchar(50)
AS

SELECT USR_ID, USR_BRANCH_CODE, USR_NAME, USR_PASSWORD, USR_MAC_ADDRESS, USR_HIERARCHY_LEVEL,USR_IS_ADMIN,USR_IS_SUPPER
FROM Users
WHERE (Usr_Name = @Usr_Name) AND (Usr_Password = @Usr_Password) AND(USR_MAC_ADDRESS=@Usr_Macaddress)
GO


Thanx
Reply With Quote
  #4 (permalink)  
Old October 1st, 2007, 08:56 AM
joefawcett's Avatar
Wrox Author
Points: 9,763, Level: 42
Points: 9,763, Level: 42 Points: 9,763, Level: 42 Points: 9,763, Level: 42
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Exeter, , United Kingdom.
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

What did you try?
Code:
CREATE PROCEDURE [dbo].[SEARCH_USERLOGING_STATUS] 
    @Usr_Name varchar(100),
    @Usr_Password varchar(50),
    @Usr_Macaddress varchar(50)
AS

SELECT    USR_ID, USR_BRANCH_CODE, USR_NAME, USR_PASSWORD, USR_MAC_ADDRESS, USR_HIERARCHY_LEVEL,USR_IS_ADMIN,USR_IS_SUPPER
FROM       Users
WHERE     (Usr_Name = @Usr_Name COLLATE SQL_Latin1_General_CP1_CS_AS) AND (Usr_Password = @Usr_Password COLLATE SQL_Latin1_General_CP1_CS_AS) AND(USR_MAC_ADDRESS=@Usr_Macaddress)
GO
--

Joe (Microsoft MVP - XML)
Reply With Quote
  #5 (permalink)  
Old October 3rd, 2007, 12:17 AM
Authorized User
 
Join Date: Nov 2005
Location: Colombo, , Sri Lanka.
Posts: 51
Thanks: 0
Thanked 0 Times in 0 Posts
Default

thank you so much joefawcett.

MSB
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to check the password field for case-sensitive zubash73 ASP.NET 2.0 Basics 4 November 27th, 2016 02:47 AM
how can i mail the password to the user? ayem Visual Studio 2008 3 August 13th, 2008 06:52 AM
what is the password and user id for ........! Random Servlets 1 November 8th, 2005 02:59 AM
user password validating cooky4 VB How-To 15 May 4th, 2005 08:45 AM
I can verify user name and password hdoldur Classic ASP Databases 2 April 3rd, 2004 07:51 PM



All times are GMT -4. The time now is 05:54 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.