I'm trying to create login form in C#.
I store username and password in SqlServer 2008 express using the stored procedure
ALTER procedure [dbo].[InsertNewUser] ( @UserName varchar(30), @Password varchar(30) ) as If exists(Select 'True' from Users where UserName = @UserName) begin --This means that the user name is taken select 'User already exists' end else begin --This means that the username is available select 'New user created' Insert into Korisnici (UserName,UserPassword) values (@UserName, @Password) end
How to check in C# when the new user is available, and when the username is taken?
When the selected username is available do the insert part and display the message "new user created" and when the username is taken display the message "username taken" and do not do the insert.
Edited 6 Years Ago by Michael27: n/a