•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the C# section within the Software Development category of DaniWeb, a massive community of 402,750 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,473 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our C# advertiser: Programming Forums
Views: 91352 | Replies: 59
![]() |
Are you using Visual Studio or Web Matrix?
If you are using Visual Studio, have you stepped though the code?
Comment out the Invalid Login portion of the code and see what error message you are getting from ASP.Net
If you are using Visual Studio, have you stepped though the code?
Comment out the Invalid Login portion of the code and see what error message you are getting from ASP.Net
Assistant Manager, Regional Pharmacy Information Systems
TLC Services Website (Under Construction)
Updated : ASP.Net Login Code
TLC Services Website (Under Construction)
Updated : ASP.Net Login Code
•
•
Join Date: Dec 2005
Posts: 4
Reputation:
Rep Power: 0
Solved Threads: 0
Anyone that would be so kind and post the stored procedure, I'm not able to get the northwind SP, and would therefore be happy if someone could show it, as i will try to get it up and running on a MS SQL 2000 server.
I'm trying with this so far:
CREATE PROCEDURE sp_ValidateUser
@UserName varchar(16), @Password varchar(16)
AS
SELECT COUNT(*) as Num_of_Users
FROM USERS
WHERE Users.username LIKE @UserName AND Users.password LIKE @Password
it returns 1 column as Num_of_Users with a either 1 or 0 depending on valid or invalid user/password
The login form ends up just saying "Invalid Login, please try again!"
Regards
Train
I'm trying with this so far:
CREATE PROCEDURE sp_ValidateUser
@UserName varchar(16), @Password varchar(16)
AS
SELECT COUNT(*) as Num_of_Users
FROM USERS
WHERE Users.username LIKE @UserName AND Users.password LIKE @Password
it returns 1 column as Num_of_Users with a either 1 or 0 depending on valid or invalid user/password
The login form ends up just saying "Invalid Login, please try again!"
Regards
Train
•
•
Join Date: Dec 2005
Posts: 4
Reputation:
Rep Power: 0
Solved Threads: 0
I did manage to create the SP myself. If anyone has the same problem this was what i wrote in my SP:
CREATE PROCEDURE sp_ValidateUser
@UserName varchar(16), @Password varchar(16)
AS
DECLARE @Num_of_User INT
SELECT @Num_of_User = COUNT(*) FROM USERS WHERE (Users.username LIKE @UserName) AND (Users.[password] LIKE @Password)
RETURN @Num_of_User
GO
Table's is abit diffrent compared to the exsampel, hope you can use it anyway
CREATE PROCEDURE sp_ValidateUser
@UserName varchar(16), @Password varchar(16)
AS
DECLARE @Num_of_User INT
SELECT @Num_of_User = COUNT(*) FROM USERS WHERE (Users.username LIKE @UserName) AND (Users.[password] LIKE @Password)
RETURN @Num_of_User
GO
Table's is abit diffrent compared to the exsampel, hope you can use it anyway
The start of the tutorial states where to find the basis on which this tutorial is built.
But here is the original Stored Procedure:
CREATE PROCEDURE sp_ValidateUser /* How it would appear in QUERY ANALYZER */
(
@UserName VARCHAR(50) = NULL,
@Password VARCHAR(50) = NULL,
@Num_of_User INT = 0
)
AS
SET @Num_of_User = (SELECT COUNT(*) AS Num_of_User
FROM NorthWindUsers
WHERE UserName = @UserName AND Password = @Password)
RETURN @Num_of_User
If you are still having troubles let me know...
But here is the original Stored Procedure:
CREATE PROCEDURE sp_ValidateUser /* How it would appear in QUERY ANALYZER */
(
@UserName VARCHAR(50) = NULL,
@Password VARCHAR(50) = NULL,
@Num_of_User INT = 0
)
AS
SET @Num_of_User = (SELECT COUNT(*) AS Num_of_User
FROM NorthWindUsers
WHERE UserName = @UserName AND Password = @Password)
RETURN @Num_of_User
If you are still having troubles let me know...
Assistant Manager, Regional Pharmacy Information Systems
TLC Services Website (Under Construction)
Updated : ASP.Net Login Code
TLC Services Website (Under Construction)
Updated : ASP.Net Login Code
Also one thing to note. I would avoid using LIKE as you will can have the chance of a guess working for the login, or even more likely to have multiple records.
A login should grab one, and only one record.
A login should grab one, and only one record.
Assistant Manager, Regional Pharmacy Information Systems
TLC Services Website (Under Construction)
Updated : ASP.Net Login Code
TLC Services Website (Under Construction)
Updated : ASP.Net Login Code
![]() |
•
•
•
•
•
•
•
•
DaniWeb C# Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
- Updated : Simple ASP.Net Login Page (ASP.NET)
- Simple ASP.Net Login Page (Using VB.Net) (ASP.NET)
Other Threads in the C# Forum
- Previous Thread: Adding a new row in a Datagrid ???????????
- Next Thread: Adding custom rows at runtime from database


Linear Mode