Click here to Skip to main content
15,890,609 members
Please Sign up or sign in to vote.
1.00/5 (4 votes)
See more:
I wants to create a registration form in asp.net.How can check whether user name and email address already exists before submitting data in to database?

*Needed to print error in separate label..
Posted
Updated 5-Jun-11 4:39am
v2
Comments
OriginalGriff 5-Jun-11 10:21am    
And?
Are you waiting for permission?
If so - go ahead, we don't mind at all!
ahmed559 5-Jun-11 10:28am    
pls answer it soon
OriginalGriff 5-Jun-11 10:31am    
Answer what? You didn't ask a question!
ahmed559 5-Jun-11 10:40am    
pls answer it..
I wants to create a registration form in asp.net.How can check whether user name and email address already exists before submitting data in to database?
*Needed to print error in separate label..
ahmed559 5-Jun-11 15:14pm    
Needed c# code to print error message in different labele(one for email and another one for username)..........

No need sql command..

What do you want us to say?
I can give you the SQL:
SELECT name, email FROM myTable WHERE name='John Smith" AND email="JohnSmith@JohnSmith.com'
If that returns any records, then the user exists!
But since you don't tell us what you need to know, we can't do much more than that!
 
Share this answer
 
Put a button beside the textbox to check the availability of the username.
Use Ajax, It will not make partial postback so no flicker on screen. Give a seamless view, that your page has not made any round trip.

and ofcourse it is not possible to check it without sending to database as you are storing the username or email to database only.

You can also implement this feature on textbox textchange event. But it will make unnecessary round trips.

So Best of luck and hope you will get my point.... :)
 
Share this answer
 
Comments
ahmed559 6-Jun-11 14:13pm    
No, I wants to get an error message to display on label,if user name and email already in db.

*using c#,sqlreader,asp.net
Lakshmimsridhar 22-Aug-12 8:32am    
if its already in db then write
select count(*) from tablename where Username={0} and Password={1}, UserName, password


without submitting to db dont have idea

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