85;. Columns [5]. Width = 107;. Columns [6]. Width = 70;. Columns [0] . HeaderText = "Жанр";. Columns [1]. HeaderText = "Назва";. Columns [2]. HeaderText = "Автор";. Columns [3]. HeaderText = "Рік видання";. Columns [4]. HeaderText = "Видавництво";. Columns [5]. HeaderText = "Код видання";. Columns [6]. HeaderText = "Кол. сторінок ";. Checked = true;. Enabled = false; ();
} void Form2_FormClosing_1 (object sender, FormClosingEventArgs e)
{. frm1.Close ();
} void dataGridView1_CellClick (object sender, DataGridViewCellEventArgs e)
{. Conn = new SqlConnection (cls.ConnectionString);. Conn.Open (); selected = Convert.ToString (dataGridView1.Rows [dataGridView1.CurrentRow.Index]. Cells [0]. Value ); comand = new SqlCommand (@ "SELECT * FROM Books WHERE (Жанр LIKE '" + Convert.ToString (selected) + "')", cls.Conn); iReader = comand.ExecuteReader (CommandBehavior.CloseConnection ); i = -1;. RowCount = 1;. ColumnCount = 7; (iReader.Read ())
{+ +;. Rows.Add (); (int j = 0; j <7; j + +)
{. Rows [i]. Cells [j]. Value = iReader [j]. ToString ();
}
}. Close ();. Enabled = true;
} void виходToolStripMenuItem_Click (object sender, EventArgs e)
{. frm1.Close ();. frm2.Close ();
} void button2_Click (object sender, EventArgs e)// додати книгу
{. frm3 = new Form3 ();. frm3.ShowDialog ();
} void добавітьToolStripMenuItem_Click (object sender, EventArgs e)
{. добавітьToolStripMenuItem.Click + = new System.EventHandler (this.button2_Click);
} void button1_Click (object sender, EventArgs e)// пошук
{(textBox1.Text == "")
{. Show ("Порожнє поле пошуку!", "Помилка пошуку", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
{text = textBox1.Text;. Conn = new SqlConnection (cls.ConnectionString);. Conn.Open (); i = -1;. RowCount = 1;. ColumnCount = 7; (radioButton1 . Checked == true)
{comand = new SqlCommand (@ "SELECT * FROM Books WHERE (Видавництво LIKE '%" + text + "%')", cls.Conn); iReader = comand.ExecuteReader (CommandBehavior.CloseConnection); (iReader.Read ())
{+ +;. Rows.Add (); (int j = 0; j <7; j + +)
{. Rows [i]. Cells [j]. Value = iReader [j]. ToString ();
}
}. Close ();
} (radioButton2.Checked == true)
{comand = new SqlCommand (@ "SELECT * FROM Books WHERE (Назва LIKE '%" + text + "%')", cls.Conn); iReader = comand.ExecuteReader (CommandBehavior.CloseConnection); (iReader.Read ())