Advertisement
Guest User

Untitled

a guest
Feb 27th, 2017
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.17 KB | None | 0 0
  1. }
  2. protected void Button1_Click(object sender, EventArgs e)
  3. {
  4. if (Page.IsValid)
  5. {
  6. SqlConnection con = new SqlConnection();
  7. con.ConnectionString = System.Configuration.ConfigurationManager.ConnectionStrings["cn"].ConnectionString;
  8. if (con.State == ConnectionState.Closed)
  9. {
  10. con.Open();
  11. }
  12. SqlCommand cmd = new SqlCommand();
  13. cmd.Connection = con;
  14. cmd.CommandText = "save_contact";
  15. cmd.Parameters.Add("@name", SqlDbType.VarChar, 50).Value = TextBox1.Text;
  16. cmd.Parameters.Add("@mobile", SqlDbType.Char, 11).Value = TextBox2.Text;
  17. cmd.Parameters.Add("@eid", SqlDbType.VarChar, 50).Value = TextBox3.Text;
  18. cmd.Parameters.Add("@address", SqlDbType.VarChar, 100).Value = TextBox4.Text;
  19. //cmd.Parameters.Add("@pid", SqlDbType.Int).Value = pid;
  20.  
  21. cmd.CommandType = CommandType.StoredProcedure;
  22.  
  23.  
  24. cmd.ExecuteNonQuery();
  25. con.Close();
  26. cmd.Dispose();
  27. string jquery = "showme();";
  28. ClientScript.RegisterStartupScript(typeof(Page), "a key",
  29. "<script type="text/javascript">" + jquery + "</script>"
  30. );
  31. }
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement