private void dataGridView1_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { DataGridViewRow dr = dataGridView1.SelectedRows[0]; boardname = dr.Cells[0].Value.ToString(); title = dr.Cells[1].Value.ToString(); content = dr.Cells[2].Value.ToString(); date = dr.Cells[3].Value.ToString(); Hide(); FreeUpdate freeUpdate = new FreeUpdate(); freeUpdate.ShowDialog(); Close(); }
private void button1_Click(object sender, EventArgs e) { GetConnection(); string id = Login.id; name = MyWriting.boardname; string content = MyWriting.content; string sql = "insert into comment(id,boardname,title,content,comment) values ('" + id + "','" + name + "','" + titletxt.Text + "','" + content + "','" + commenttxt.Text + "')"; MySqlCommand cmd = new MySqlCommand(sql, conn); conn.Open(); cmd.ExecuteNonQuery(); conn.Close(); this.Hide(); FreeUpdate free = new FreeUpdate(); free.ShowDialog(); this.Close(); }