//подробнее об аниме private void button1_Click(object sender, EventArgs e) { try { connection.Open(); OleDbCommand command = new OleDbCommand(); command.Connection = connection; command.CommandText = "SELECT id FROM Anime_info WHERE Anime_info.name_an='" + dataGridView7[0, dataGridView7.CurrentRow.Index].Value.ToString() + "' AND Anime_info.tip_an='" + dataGridView7[1, dataGridView7.CurrentRow.Index].Value.ToString() + "'"; //AND collSer_an=" + dataGridView7[2, dataGridView7.CurrentRow.Index].Value.ToString() + " AND ogranich_an='" + dataGridView7[3, dataGridView7.CurrentRow.Index].Value.ToString() + "'"; OleDbDataReader reader = command.ExecuteReader(); int i = -1; while (reader.Read()) { i = int.Parse(reader[0].ToString()); } connection.Close(); frm4 = new Form4_AnimeProfil(i, id_User); frm4.Show(); } catch (Exception ex) { MessageBox.Show("FAIL " + ex); connection.Close(); } }
//вызов аниме профиля private void button1_Click_1(object sender, EventArgs e) { try { connection.Open(); OleDbCommand command = new OleDbCommand(); command.Connection = connection; if (ReadProfSpis == "Смотрю") { if (dataGridView1[0, dataGridView1.CurrentRow.Index].Value.ToString() != "") { command.CommandText = "SELECT id FROM Anime_info WHERE Anime_info.name_an='" + dataGridView1[0, dataGridView1.CurrentRow.Index].Value.ToString() + "'"; } else { ReadProfSpis = "-1"; } } if (ReadProfSpis == "Смотрел") { if (dataGridView2[0, dataGridView2.CurrentRow.Index].Value.ToString() != "") { command.CommandText = "SELECT id FROM Anime_info WHERE Anime_info.name_an='" + dataGridView2[0, dataGridView2.CurrentRow.Index].Value.ToString() + "'"; } else { ReadProfSpis = "-1"; } } if (ReadProfSpis == "Буду смотреть") { if (dataGridView3[0, dataGridView3.CurrentRow.Index].Value.ToString() != "") { command.CommandText = "SELECT id FROM Anime_info WHERE Anime_info.name_an='" + dataGridView3[0, dataGridView3.CurrentRow.Index].Value.ToString() + "'"; } else { ReadProfSpis = "-1"; } } if (ReadProfSpis == "-1") { connection.Close(); ReadProfSpis = ""; return; } if (ReadProfSpis == "") { command.CommandText = "SELECT id FROM Anime_info WHERE Anime_info.name_an='" + dataGridView7[0, dataGridView7.CurrentRow.Index].Value.ToString() + "' AND Anime_info.tip_an='" + dataGridView7[1, dataGridView7.CurrentRow.Index].Value.ToString() + "'"; //AND collSer_an=" + dataGridView7[2, dataGridView7.CurrentRow.Index].Value.ToString() + " AND ogranich_an='" + dataGridView7[3, dataGridView7.CurrentRow.Index].Value.ToString() + "'"; } OleDbDataReader reader = command.ExecuteReader(); int i = -1; while (reader.Read()) { i = int.Parse(reader[0].ToString()); } connection.Close(); frm4 = new Form4_AnimeProfil(i, id_User); frm4.Show(); ReadProfSpis = ""; } catch (Exception ex) { //MessageBox.Show("FAIL " + ex); MessageBox.Show("Не выбран тайтл"); connection.Close(); } }