private void btn_Zmazat_Reklamaciu_Click(object sender, EventArgs e) { SqlConnection MyConn = new SqlConnection(pripojenie); MyConn.Open(); string delete = "delete from Reklamacia where ID_Reklamacia='" + cb_ID_Reklamacie.Text + "';"; sql = new SqlCommand(delete, MyConn); sql.ExecuteNonQuery(); ds_Reklamacie.Tables["Reklamacia"].Clear(); MyAdapter2.Fill(ds_Reklamacie, "Reklamacia"); dgw_Reklamacie.DataSource = ds_Reklamacie.Tables["Reklamacia"]; }
private void btn_Pridaj_Reklamaciu_Click(object sender, EventArgs e) { SqlConnection MyConn = new SqlConnection(pripojenie); MyConn.Open(); string insert = "insert into Reklamacia(ID_Reklamacia,Datum_Podania,Stav,Predmet,Uzivatel_Username, Objednavka_ID_Objednavka) " + "values (next value for sekReklamacia, '" + dtp_Reklamacia.Text + "','" + cb_Predmet_Reklamacie.Text + "', " + "'" + cb_Stav_Reklamacie.Text + "','" + cb_Uzivatel_Reklamacie.Text + "','" + cb_ID_Objednavky_Reklamacie.Text + "') "; sql = new SqlCommand(insert, MyConn); sql.ExecuteNonQuery(); ds_Reklamacie.Tables["Reklamacia"].Clear(); MyAdapter2.Fill(ds_Reklamacie, "Reklamacia"); dgw_Reklamacie.DataSource = ds_Reklamacie.Tables["Reklamacia"]; }
private void btn_Editovat_Reklamaciu_Click(object sender, EventArgs e) { SqlConnection MyConn = new SqlConnection(pripojenie); MyConn.Open(); string update = "UPDATE Reklamacia SET Datum_Podania = '" + dtp_Reklamacia.Text + "', " + "Stav = '" + cb_Stav_Reklamacie.Text + "', " + "Predmet = '" + cb_Predmet_Reklamacie.Text + "', " + "Uzivatel_Username = '******', " + "Objednavka_ID_Objednavka = '" + cb_ID_Objednavky_Reklamacie.Text + "' WHERE ID_Reklamacia = '" + cb_ID_Reklamacie.Text + "'"; sql = new SqlCommand(update, MyConn); sql.ExecuteNonQuery(); ds_Reklamacie.Tables["Reklamacia"].Clear(); MyAdapter2.Fill(ds_Reklamacie, "Reklamacia"); dgw_Reklamacie.DataSource = ds_Reklamacie.Tables["Reklamacia"]; }