protected void btnSignUp_Click(object sender, EventArgs e) { try { var context = new InstanceContext(new MEPCallBack()); var c = new MEPClient(context); var con = new SqlConnection("Data Source=DESKTOP-3ABOOA3\\sqlexpress01;Initial Catalog=MEPDb;Integrated Security=True"); var cmd = new SqlCommand("insert into UserRegistration(UserEmail) values (@UserEmail)", con); cmd.Parameters.AddWithValue("@UserEmail", txtUserEmail.Text.ToString()); con.Open(); cmd.ExecuteNonQuery(); con.Close(); c.SendEmail(txtUserEmail.Text.ToString()); } catch (FaultException Ex) { Response.Write(Ex.Message); } }
protected void Button1_Click(object sender, EventArgs e) { try { //MEPClient c = new MEPClient(); var context = new InstanceContext(new MEPCallBack()); MEPClient c = new MEPClient(context); var con = new SqlConnection("Data Source=.;Initial Catalog=NETTest;Integrated Security=True"); var cmd = new SqlCommand("INSERT INTO UserRegistration(UserEmail) VALUES(@userEmail)", con); cmd.Parameters.AddWithValue("@userEmail", txtUserEmail.Text.ToString()); con.Open(); cmd.ExecuteNonQuery(); con.Close(); c.sendEmail(txtUserEmail.Text.ToString()); GridView1.DataBind(); } catch (Exception Ex) { Response.Write(Ex.Message); } }