Buy Questpond's video subscriptions on
huge discount
.
Online: 12039
Home
Articles
Interviews
Forums
For Beginners
Popular Questions
ITIL Career Advice
PMP Career Advice
Career Advices
Codes
Videos
ASP.NET
ASP.NET MVC
Android Intel XDK
Sql Server
AngularJS
Bootstrap
Backbone.JS
MongoDB
LESS (CSS)
jQuery
WPF
WWF
SSIS
LightSwitch
Tutorials
News
ASP.NET MVC
|
Be Interview Ready
|
Top Performers
|
DNF MVP
|
Top Posts
|
Winners
|
Subscribe
|
Catalogs
Welcome Guest !
Register
Login
Home
>
Forums
>
ASP.NET
>
Loading ...
check a duplicates user_name value in database
Posted by
Bhuwan87rawat
under
ASP.NET
on 8/23/2012 |
Points: 10
| Views : 3375 | Status :
[Member]
| Replies : 5
Write New Post
|
Search Forums
|
Resolved Posts
|
Un Answered Posts
|
Forums Home
Hi
In my application i want to check a duplicates user_name value in database with help of store
procedure . it is possible...
Regard
Bhuwan
Reply
|
Reply with Attachment
Alert Moderator
Responses
Posted by:
Nadh123
on: 8/23/2012
[Member]
Starter
|
Points: 25
0
CREATE PROC PR_GET_CHECK_USER_NAME
(
@IP_USER_NAME VARCHAR(26),
@OP_RETURN_MSG VARCHAR(100) OUTPUT
)
AS
/* EXECUTION
DECLARE @X VARCHAR(100)
EXEC PR_GET_CHECK_USER_NAME 'USERNAME' ,@X OUTPUT
SELECT @X AS RETURNMESSAGE */
BEGIN
DECLARE @LV_USER_ID INT
SELECT @LV_USER_ID =[USER_ID]
FROM USERS
WHERE [USER_NAME]=@IP_USER_NAME
IF @LV_USER_ID >0
BEGIN
SET @OP_RETURN_MSG= 'USER IS EXISTS'
END
ELSE
BEGIN
SET @OP_RETURN_MSG= 'USER IS NOT EXISTS'
END
END
Mahendra
91-9908699686
Bhuwan87rawat
, if this helps please
login
to
Mark As Answer
. |
Alert Moderator
Posted by:
Bhuwan87rawat
on: 8/23/2012
[Member]
Starter
|
Points: 25
0
sir in my application i make a registration form and i check the username already exist in database with the help of
store procedure.....
Bhuwan87rawat
, if this helps please
login
to
Mark As Answer
. |
Alert Moderator
Posted by:
Rickeybglr
on: 8/24/2012
[Member]
Starter
|
Points: 25
0
ALTER PROCEDURE [dbo].[USP_NewUserRegistration]
(
@strUserName nvarchar(50),
@strFirstName nvarchar(50),
@strEmail nvarchar(50),
@strPassword nvarchar(50),
@iAge int,
@strCity nvarchar(50),
@iPhoneNo numeric
AS
BEGIN
DECLARE @UID INT=0
IF @strusername NOT IN (SELECT UserName from userRegistrationTB)
BEGIN
INSERT INTO userRegistrationTB
(
username,
firstname,
lastname,
useremail,
[password],
age,
city,
phone,
CreatedDate
)
VALUES
(
@strUserName,
@strFirstName,
@strEmail,
@strPassword,
@iAge,
@strCity,
@iPhoneNo,
GETDATE()
)
END
ELSE
BEGIN
SELECT 'user already exists pleae choose different username'
END
SET NOCOUNT ON;
END
Bhuwan87rawat
, if this helps please
login
to
Mark As Answer
. |
Alert Moderator
Posted by:
Nkkppp
on: 8/24/2012
[Member]
Starter
|
Points: 25
0
Simple stored procedure to check duplicate Username
@username parameter will the textbox value from the front end
Create Procedure Check_Username(@username)
as
Begin
if Not exists(select * from Users where username=@Username)
Insert into Users values(@username)
End
In the front end take a variable i and write the foll code
Sqlcommand cmd;
int i=cmd.ExecuteNonquery();
if(i>0)
Enter into the Main page of Website
else
label1.text="User already exists";
Bhuwan87rawat
, if this helps please
login
to
Mark As Answer
. |
Alert Moderator
Posted by:
Maheshvishnu
on: 9/7/2012
[Member]
Starter
|
Points: 25
0
create procedure check_user(@userid varchar(50))
as
begin
if exists(select * from table where userid=@userid)_
return false;
else
print 'no records exists for given userid'
end
mahesh
Bhuwan87rawat
, if this helps please
login
to
Mark As Answer
. |
Alert Moderator
Login to post response
Latest Posts
How to get the exact property name while getting error
(0)
PDB file is not showing Line Number in dot net application hosted on server
(0)
Both Strings morethan 5 letters in length end of the words one vowel and one consonent is different
(0)
how to check Any adjacent letters transposed between two strings(ex: JOHN, JHON)
(1)
can't receive data after success login ?
(1)
Implement Multi-Tenant in Azure Logic Apps
(0)
Why ASP.Net Core 7.0 Web API showing as Connection refused?
(0)
Iterating over columns of dataframe and print as rows in Python Django
(0)
More ...