Объясните, пожалуйста, как работают кнопки, если можно с комментариями к коду

  1. Посчитать прибыль
private void button2_Click(object sender, EventArgs e)
        {
            dataGridView1.EndEdit();
            dataGridView2.EndEdit();
 
            this.produktsiyaTableAdapter.Update(this.v47DataSet.produktsiya);
            this.izgotovleniyeTableAdapter.Update(this.v47DataSet.izgotovleniye);
 
            OleDbConnection conn = new OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=|DataDirectory|\\v47.accdb");
            conn.Open();
            OleDbCommand command2 = new OleDbCommand("UPDATE tsekh INNER JOIN (produktsiya INNER JOIN izgotovleniye ON produktsiya.nomer_produktsii = izgotovleniye.nomer_produktsii) ON tsekh.nomer = izgotovleniye.nomer SET izgotovleniye.pribyl = ([izgotovleniye]![tsena_prodazhi]*[izgotovleniye]![kol_realizovano])-([produktsiya]![sebestoimost]*[izgotovleniye]![kol_realizovano])", conn);
 
            command2.ExecuteNonQuery();
            conn.Close();
 
            this.produktsiyaTableAdapter.Update(this.v47DataSet.produktsiya);
            this.izgotovleniyeTableAdapter.Update(this.v47DataSet.izgotovleniye);
        }
  1. Сортировать
private void button3_Click(object sender, EventArgs e)
        {
            if (radioButton3.Checked == true)
            {
                if (radioButton7.Checked == true)
                {
                    produktsiyaBindingSource.Sort = "nomer_produktsii ASC"; ;
                }
                if (radioButton6.Checked == true)
                {
                    produktsiyaBindingSource.Sort = "nomer_produktsii DESC"; ;
                }
            }
            if (radioButton4.Checked == true)
            {
                if (radioButton7.Checked == true)
                {
                    produktsiyaBindingSource.Sort = "sebestoimost ASC";
                }
                if (radioButton6.Checked == true)
                {
                    produktsiyaBindingSource.Sort = "sebestoimost DESC";
                }
            }
            if (radioButton5.Checked == true)
            {
                if (radioButton7.Checked == true)
                {
                    produktsiyaizgotovleniyeBindingSource.Sort = "kol_izgotovleno ASC"; ;
                }
                if (radioButton6.Checked == true)
                {
                    produktsiyaizgotovleniyeBindingSource.Sort = "kol_izgotovleno DESC"; ;
                }
            }
            if (radioButton1.Checked == true)
            {
                if (radioButton7.Checked == true)
                {
                    produktsiyaizgotovleniyeBindingSource.Sort = "kol_realizovano ASC"; ;
                }
                if (radioButton6.Checked == true)
                {
                    produktsiyaizgotovleniyeBindingSource.Sort = "kol_realizovano DESC"; ;
                }
            }
            if (radioButton2.Checked == true)
            {
                if (radioButton7.Checked == true)
                {
                    produktsiyaizgotovleniyeBindingSource.Sort = "pribyl ASC"; ;
                }
                if (radioButton6.Checked == true)
                {
                    produktsiyaizgotovleniyeBindingSource.Sort = "pribyl DESC"; ;
                }
            }
        }
  1. Применить фильтр
private void button6_Click(object sender, EventArgs e)
        {
            string znak = " ";
            int caseSwitch1 = listBox2.SelectedIndex;
 
            switch (caseSwitch1)
            {
                case 0:
                    znak = "<";
                    break;
                case 1:
                    znak = ">";
                    break;
                case 2:
                    znak = "=";
                    break;
            }
            int caseSwitch = listBox1.SelectedIndex;
            switch (caseSwitch)
            {
                case 0:
                    produktsiyaBindingSource.Filter =
                   "nomer_produktsii" + znak + "'" + textBox9.Text + "'";
                    break;
                case 1:
                    produktsiyaBindingSource.Filter =
                    "sebestoimost" + znak + "'" + textBox9.Text + "'";
                    break;
                case 2:
                    produktsiyaizgotovleniyeBindingSource.Filter =
                    "tsena_prodazhi" + znak + "'" + textBox9.Text + "'";
                    break;
                case 3:
                    produktsiyaizgotovleniyeBindingSource.Filter =
                    "pribyl" + znak + "'" + textBox9.Text + "'";
                    break;
            }
        }
  1. Убрать фильтр
private void button4_Click(object sender, EventArgs e)
        {
            produktsiyaBindingSource.RemoveFilter();
            produktsiyaizgotovleniyeBindingSource.RemoveFilter();
        }
 
        private void button1_Click(object sender, EventArgs e)
        {
            dataGridView1.EndEdit();
            dataGridView2.EndEdit();
 
            this.produktsiyaTableAdapter.Update(this.v47DataSet.produktsiya);
            this.izgotovleniyeTableAdapter.Update(this.v47DataSet.izgotovleniye);
 
            OleDbConnection conn = new OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=|DataDirectory|\\v47.accdb");
            conn.Open();
            OleDbCommand command2 = new OleDbCommand("UPDATE produktsiya INNER JOIN izgotovleniye ON produktsiya.nomer_produktsii = izgotovleniye.nomer_produktsii SET izgotovleniye.nazvaniye = [produktsiya]![nazvaniye]", conn);
 
            command2.ExecuteNonQuery();
            conn.Close();
 
            this.produktsiyaTableAdapter.Update(this.v47DataSet.produktsiya);
            this.izgotovleniyeTableAdapter.Update(this.v47DataSet.izgotovleniye);
        }
  1. Заполнить название продукции
private void button1_Click(object sender, EventArgs e)
        {
            dataGridView1.EndEdit();
            dataGridView2.EndEdit();
 
            this.produktsiyaTableAdapter.Update(this.v47DataSet.produktsiya);
            this.izgotovleniyeTableAdapter.Update(this.v47DataSet.izgotovleniye);
 
            OleDbConnection conn = new OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=|DataDirectory|\\v47.accdb");
            conn.Open();
            OleDbCommand command2 = new OleDbCommand("UPDATE produktsiya INNER JOIN izgotovleniye ON produktsiya.nomer_produktsii = izgotovleniye.nomer_produktsii SET izgotovleniye.nazvaniye = [produktsiya]![nazvaniye]", conn);
 
            command2.ExecuteNonQuery();
            conn.Close();
 
            this.produktsiyaTableAdapter.Update(this.v47DataSet.produktsiya);
            this.izgotovleniyeTableAdapter.Update(this.v47DataSet.izgotovleniye);
        }

Так а что именно не понятно?

Тут надо читать про БД, SQL, ADO .NET.


При вставке кода на форуме надо нажимать кнопку Код .
И тут еще внутри кода были ссылки на смайлы другого форума, видимо потому что там она тоже не была нажата. :dadparrot: