using (SqlConnection con = new SqlConnection(_constr)) { string query = "select Password,email from login where email='" + txtemail.Text + "'"; SqlCommand cmd = new SqlCommand(query, con); SqlDataAdapter da = new SqlDataAdapter(cmd); DataSet ds = new DataSet(); da.Fill(ds); int rowcount = ds.Tables[0].Rows.Count; if (rowcount > 0) { email = ds.Tables[0].Rows[0]["email"].ToString(); password = ds.Tables[0].Rows[0]["password"].ToString(); MailMessage mail = new MailMessage(); mail.From = new MailAddress("gmailid"); mail.To.Add(email); mail.Subject = "Reg. Password "; mail.Body = " Your Password for the user" + " " + txtemail.Text.ToString() + " " + " is " + password; mail.Priority = System.Net.Mail.MailPriority.High; SmtpClient client = new SmtpClient(); client.Credentials = new System.Net.NetworkCredential("gmailid", "password"); client.Port = 587; // Gmail works on this port client.Host = "smtp.gmail.com"; client.EnableSsl = true; //Gmail works on Server Secured Layer //lbl6.Text = " The password has successfully sent to " + email; client.Send(mail); } }
01 CREATE PROCEDURE CheckUserName( @User_Name VARCHAR(50) ) 02 AS 03 BEGIN 04 05 IF EXISTS (SELECT * FROM User_Table WHERE [User_Name] = @User_Name ) 06 07 SELECT '1'; --user name already exist in database 08 09 ELSE 10 11 SELECT '0'; --user name does not exist in database 12 13 END
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)