Wrox Programmer Forums
Go Back   Wrox Programmer Forums > SQL Server > SQL Server 2000 > SQL Server 2000
|
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 software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old September 29th, 2007, 05:58 AM
Authorized User
 
Join Date: Nov 2005
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
 
Old September 29th, 2007, 09:00 AM
joefawcett's Avatar
Wrox Author
 
Join Date: Jun 2003
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)
 
Old October 1st, 2007, 01:21 AM
Authorized User
 
Join Date: Nov 2005
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
 
Old October 1st, 2007, 08:56 AM
joefawcett's Avatar
Wrox Author
 
Join Date: Jun 2003
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)
 
Old October 3rd, 2007, 12:17 AM
Authorized User
 
Join Date: Nov 2005
Posts: 51
Thanks: 0
Thanked 0 Times in 0 Posts
Default

thank you so much joefawcett.

MSB





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





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.