
December 2nd, 2012, 08:03 PM
|
|
Registered User
|
|
Join Date: Oct 2012
Posts: 4
Time spent in forums: 1 h 30 m 45 sec
Reputation Power: 0
|
|
Quote: | Originally Posted by adelle Create stored procedure for users registration. Procedure accepts two parameters: username and password and introduces these two values into table entitled Users. Table users has three columns: ID, username and password. When activating procedure it is first to check if the user with that username already exists in the table. If exists, the entry does not execute and the procedure returns an error message (number -1). If the user does not exist the entry introduces to database and the procedure returns success message (zero 0). |
IMO, this would be my approach:
create procedure dbo.SearchUser @username as varchar(30)
As
select username from userslist where username = @username
Then in my code (Usually VB.net) i would create a sub which would check if the procedure would return a value, if yes, then i would prompt a message box and end the transaction, if false then the transaction would proceed.

|