Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 1.0 and 1.1 > ASP.NET 1.0 and 1.1 Professional
Password Reminder
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
ASP.NET 1.0 and 1.1 Professional For advanced ASP.NET 1.x coders. Beginning-level questions will be redirected to other forums. NOT for "classic" ASP 3 or the newer ASP.NET 2.0 and 3.5
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 Professional section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old October 15th, 2005, 02:01 AM
Friend of Wrox
Join Date: May 2005
Location: , , .
Posts: 149
Thanks: 0
Thanked 0 Times in 0 Posts
Default how to verify email exists?

Hi everyone,
I have a simple question.I have the following code written.It is a simple registration form.Now how can I verify the email already exists in the database through the code?
I used do-loop in asp classic but in .net I dhave no idea.!!!

<script runat="server" language="vb">
sub insertdata(sender as object,e as eventargs)
dim strconnection as string="server=(local);database=Test;integrated security=true;"
dim objconnection as new sqlconnection(strconnection)

dim strsql as string="insert into Register(Name,Family,Tel,email,Password,Confirmpas sword)" & _
"values (@Name,@Family,@Tel,@email,@Password,@Confirmpassw ord);"
dim objcommand as new sqlcommand(strsql,objconnection)
objcommand.parameters.add("@name",sqldbtype.nvarch ar)
objcommand.parameters.add("@Family",sqldbtype.nvar char)
objcommand.parameters.add("@Tel",sqldbtype.nvarcha r)
objcommand.parameters.add("@email",sqldbtype.nvarc har)
objcommand.parameters.add("@Password",sqldbtype.nv archar)
objcommand.parameters.add("@Confirmpassword",sqldb type.nvarchar)
objcommand.parameters("@Family").value=txtfamily.t ext
objcommand.parameters("@email").value=txtemail.tex t
objcommand.parameters("@Password").value=txtpasswo rd.text
objcommand.parameters("@Confirmpassword").value=tx tConfirm.text
end sub

  #2 (permalink)  
Old October 15th, 2005, 12:06 PM
Imar's Avatar
Wrox Author
Points: 72,055, Level: 100
Points: 72,055, Level: 100 Points: 72,055, Level: 100 Points: 72,055, Level: 100
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,086
Thanks: 80
Thanked 1,587 Times in 1,563 Posts

What you could do is execute a SELECT statement that either returns a record, or a number indicating the number of records with the same e-mail address.

Something like this:

SELECT COUNT(EmailAddress) FROM MyTable WHERE EmailAddress = 'Email'

Then you can use ExecuteScalar of your SqlCommand object which returns this number and cast it to an Integer. When it's 0, the email address doesn't exist.


Imar Spaanjaars
Everyone is unique, except for me.

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
how to verify email exists? keyvanjan ASP.NET 2.0 Basics 1 November 30th, 2009 08:20 AM
Resolved! - Verify Required fields and email form dartcoach HTML Code Clinic 25 April 28th, 2008 12:48 PM
check if email account exists collie ASP.NET 2.0 Basics 2 September 13th, 2007 07:02 PM
How to verify domain exists ? leo_vinay Classic ASP Professional 1 September 17th, 2004 04:05 AM

All times are GMT -4. The time now is 05:55 AM.

Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.