private void Löschenbutton_Click(object sender, EventArgs e) { try { if (Löschen.Text != "") { string cmdstr = "DELETE FROM Buchungen WHERE Belegnummer = " + Löschen.Text; OleDbCommand cmd; OleDbConnection conn; conn = new OleDbConnection(Properties.Settings.Default.DBSConnectionString1); conn.Open(); cmd = new OleDbCommand(cmdstr, conn); cmd.ExecuteNonQuery(); conn.Close(); dataGridView1.Update(); Buchungen a = new Buchungen(r); this.Close(); a.Show(); } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
private void button1_Click(object sender, EventArgs e) { try { OleDbCommand cmd; OleDbConnection conn; string cmdstr; conn = new OleDbConnection(Properties.Settings.Default.DBSConnectionString1); if (combcheck1 && combcheck2 && wertcheck && eadatum && redatum) { conn.Open(); //cmdstr = "INSERT INTO Buchungen ([Art], [Ust], [Wert], [Ust-Summe], [Re-Datum], [EA-Datum]) VALUES ('" + Art_cbx.Text + "'," + Ust_cbx.Text + "," + Wert.Text + "," + Ust_Summe.Text + ",'" + Re_Datum.Text + "','" + EA_Datum.Text + "');"; cmd = new OleDbCommand(); cmd.CommandType = CommandType.Text; cmd.CommandText = "INSERT INTO Buchungen ([Art], [Ust], [Wert], [Ust-Summe], [Re-Datum], [EA-Datum]) VALUES (?,?,?,?,?,?);"; cmd.Parameters.AddWithValue("@Art", Art_cbx.Text); cmd.Parameters.AddWithValue("@Ust", Ust_cbx.Text); cmd.Parameters.AddWithValue("@Wert", Wert.Text); cmd.Parameters.AddWithValue("@Ust-Summe", Ust_Summe.Text); cmd.Parameters.AddWithValue("@Re-Datum", Re_Datum.Text); cmd.Parameters.AddWithValue("@EA-Datum", EA_Datum.Text); cmd.Connection = conn; //cmd = new OleDbCommand(cmdstr, conn); cmd.ExecuteNonQuery(); conn.Close(); Buchungen a = new Buchungen(r); this.Close(); a.Show(); } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
private void Buchungen_Click(object sender, EventArgs e) { Buchungen a = new Buchungen(r); a.Show(); }