I've made one Form to create a database entry.
Code:
private void button10_Click(object sender, EventArgs e)
{
clsMSSQL.clsMSSQL ticket = new clsMSSQL.clsMSSQL(5);
string query = "INSERT INTO ticket.support (titel, beschreibung, kategorie, ersteller, bearbeiter, email, abteilung) " +
"Values('" + textBox1.Text + "', '" + textBox2.Text + "', '" + comboBox1.Text + "', '" + textBox4.Text + "', '" + textBox5.Text + "', '" + textBox8.Text + "', '" + comboBox3.Text + "')";
ticket.Query(query);
ticket.Close();
this.Close();
}
now I want to make another form which will be opened by a button on the main form. This form should be able to make changes on the database and should specifically change the selected row in the database sorted by the ID.
I've tried something like:
clsMSSQL.clsMSSQL edit= new clsMSSQL.clsMSSQL(5);
string pSQL = "UPDATE INTO ticket.support WHERE id='" + dataGridView1.Rows[i].Cells[11].Value.ToString() + "'";
clsMSSQL.ExecuteCommand(pSQL);
but that wouldn't work. And because I try to do that on a second form, the code can't find dataGridView1.