Click here to Skip to main content
15,919,613 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi all,
i am working on a login form. what i want is only those user will be able to login
whose record is in our db table.
i tried stored procedure for this but not able to put logic.
please me out of this.
kudos
neaS
Posted
Comments
Herman<T>.Instance 4-Aug-11 6:42am    
can you show your code?
[no name] 4-Aug-11 6:43am    
What have you tried so far? Show us your code.

Have a look,

Sql Count.asp[^]

Sql where[^]

So the logic will be ,

C#
if( SELECT COUNT(*) FROM YOUR_TABLE WHERE USERNAME=USER_INPUT_USERNAME > 0 ) then
 do something
else
 No such user exists

Hope it helps :)
 
Share this answer
 
for the stored procedure you can use

SQL
CREATE PROCEDURE [dbo].[SE_SelSecUserCredentials]
	@UserName	NVARCHAR(45),
	@PassWord	NVARCHAR(45)
AS
begin
	SELECT
		 thefiels or count you need
	FROM 
		UserTable
	WHERE 	loginName = @UserName
	AND	BINARY_CHECKSUM(password) = BINARY_CHECKSUM(@PassWord)
end


We do a Binary_Checksum on the password to keep up with capitals in the password. a lower case for a capital will not give you a result (a in binary is different value than A)
 
Share this answer
 
v3

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900