protected void ImageButton2_Click1(object sender, ImageClickEventArgs e) { con.Open(); SqlDataAdapter sda = new SqlDataAdapter("select * from regis where uname='" + txtunm.Text + "' and cel='" + txtcno.Text + "' and dob='" + txtdb.Text + "'", con); DataSet ds = new DataSet(); sda.Fill(ds); if (ds.Tables[0].Rows.Count > 0) { Session["ids"] = ds.Tables[0].Rows[0]["id"].ToString(); Session["email"] = ds.Tables[0].Rows[0]["mail"].ToString(); SendSMS.SendEmail(Session["email"].ToString(), "your password is " + ds.Tables[0].Rows[0]["pass"].ToString(), "password", ""); RegisterStartupScript("msg", "<script>alert('password send to registered email address')</script>"); } else { RegisterStartupScript("msg", "<script>alert('invalid account information')</script>"); } con.Close(); // Response.Redirect("default2.aspx"); }