How to check the email username exist or not?

Posted by Prabu_Spark under ASP.NET on 11/12/2012 | Points: 10 | Views : 1753 | Status : [Member] | Replies : 3
Hi sir,
I design the one registration form. In that form, i want to check the availability of email id. Tell me the c# code to check it. Kindly give me the solution for this problem.


[Note: For example,i want to check the availability of priya007@gmail.com
in gmail or ymail or rediffmail]



With regards,
J.Prabu
[Email:prbspark@gmail.com]

With regards,
J.Prabu.
[Email:prbspark@gmail.com]



Responses

Posted by: Vuyiswamb on: 11/13/2012 [Member] [MVP] [Administrator] NotApplicable | Points: 25

Up
0
Down
create a stored procedure that will check if the email exist


sp_CheckemailExistance


and use it in C# as it is done below



public int CheckEmailExistance(String _sEMAIL)
{
con = new SqlConnection(strCon);

cmdselect = new SqlCommand();

cmdselect.CommandText = "sp_CheckemailExistance";

cmdselect.CommandType = CommandType.StoredProcedure;

cmdselect.Connection = con;

cmdselect.Parameters.Add("@EMAIL", SqlDbType.VarChar).Value = _sEMAIL;

cmdselect.Parameters.Add("@RESULTS", SqlDbType.Int);

cmdselect.Parameters["@RESULTS"].Direction = ParameterDirection.Output;

int isValid = 0;

try
{
con.Open();

cmdselect.ExecuteNonQuery();

isValid = (int)cmdselect.Parameters["@RESULTS"].Value;

}
catch (SqlException ex)
{
throw ex;
}
finally
{
con.Close();
}
return isValid;
}


Thank you for posting at Dotnetfunda
[Administrator]

Prabu_Spark, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Sravya on: 11/15/2012 [Member] Starter | Points: 25

Up
0
Down
Hi..

This link might be Help you.. Go through this...
http://www.c-sharpcorner.com/UploadFile/kirtan007/check-if-email-address-really-exist-or-not-using-C-Sharp/

Thanks & Regards
Sravya

Prabu_Spark, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: perfectchourasia-9163 on: 11/30/2012 [Member] Starter | Points: 25

Up
0
Down
http://sandeep-chourasia.blogspot.in/2011/05/check-username-if-it-exist-in-database.html

ER sandeep chourasia
sandeepchrs@yahoo.com (on facebook)
http://www.aspnetcodes.com/

Prabu_Spark, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response