コード例 #1
0
        private void btn_update_Click(object sender, EventArgs e)
        {
            con.Close();
            email           = txt_email.Text;
            phone           = txt_phone.Text;
            cmd             = new SqlCommand("update_data", con);
            cmd.CommandType = CommandType.StoredProcedure;
            //to pass values to the stored procedure
            cmd.Parameters.AddWithValue("@username", user);
            cmd.Parameters.AddWithValue("@email", email);
            cmd.Parameters.AddWithValue("@phone", phone);
            //execute stored procedure
            con.Open();
            cmd.ExecuteNonQuery();
            MessageBox.Show("Data updated");
            User_home uh = new User_home();

            //this.Hide();
            uh.ShowDialog();
        }