using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace WindowsApplication2
{
    public partial class EditMember : Form
    {
        public EditMember()
        {
            InitializeComponent();
        }

        private void Form5_Load(object sender, EventArgs e)
        {
            // TODO: This line of code loads data into the 'dataSet21.remembers' table. You can move, or remove it, as needed.
            this.remembersTableAdapter.Fill(this.dataSet21.remembers);

        }

        private void button1_Click(object sender, EventArgs e)
        {
            textBox1.Text = "";
            textBox2.Text = "";
            textBox3.Text = "";
            textBox4.Text = "";
            textBox5.Text = "";
        }

        private void button3_Click(object sender, EventArgs e)
        {
            sqlDataAdapter1.Update(dataSet21);
            this.Close();
        }

        private void button2_Click(object sender, EventArgs e)
        {
            sqlDataAdapter1.UpdateCommand.Parameters.Clear();
            sqlDataAdapter1.UpdateCommand.CommandText="UPDATE [remembers] SET [nameRemember] = @nameRemember, [familyRemember] = @familyRemember, [fatherName] = @fatherName, [addressRemember] = @addressRemember, [telRemember] = @telRemember WHERE idRemember=@id";

            sqlDataAdapter1.UpdateCommand.Parameters.AddWithValue("@id",Convert.ToInt32(label6.Text));
            sqlDataAdapter1.UpdateCommand.Parameters.AddWithValue("@nameRemember",textBox1.Text);
            sqlDataAdapter1.UpdateCommand.Parameters.AddWithValue("@familyRemember",textBox2.Text);
            sqlDataAdapter1.UpdateCommand.Parameters.AddWithValue("@fatherName",textBox3.Text);
            sqlDataAdapter1.UpdateCommand.Parameters.AddWithValue("@telRemember",textBox4.Text);
            sqlDataAdapter1.UpdateCommand.Parameters.AddWithValue("@addressRemember",textBox5.Text);

            sqlConnection1.Open();
            sqlDataAdapter1.UpdateCommand.ExecuteNonQuery();
            sqlConnection1.Close();

            sqlDataAdapter1.Update(dataSet21);
            this.Refresh();
        }
    }
}