Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C# ASP.NET SQL
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 5-Jun-11 4:20am
Edited 5-Jun-11 4:39am
v2
Comments
OriginalGriff at 5-Jun-11 10:21am
   
And?
Are you waiting for permission?
If so - go ahead, we don't mind at all!
ahmed559 at 5-Jun-11 10:28am
   
pls answer it soon
OriginalGriff at 5-Jun-11 10:31am
   
Answer what? You didn't ask a question!
ahmed559 at 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 at 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..
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

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!
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

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.... Smile | :)
  Permalink  
Comments
ahmed559 at 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 at 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)

  Print Answers RSS
0 Maciej Los 614
1 OriginalGriff 410
2 CPallini 230
3 RyanDev 161
4 Hard_Rockz 125
0 OriginalGriff 5,784
1 Sergey Alexandrovich Kryukov 4,838
2 Peter Leow 3,009
3 Maciej Los 2,894
4 DamithSL 2,465


Advertise | Privacy | Mobile
Web03 | 2.8.140721.1 | Last Updated 22 Aug 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100