public static void izbrisiSmenu(Smena s) { OleDbCommand cmd = new OleDbCommand("DELETE FROM Smena WHERE [ID] = @ID AND [Datum] = @Datum", connect); cmd.Parameters.AddWithValue("@ID", s.ID); cmd.Parameters.AddWithValue("@Datum", s.Datum); connect.Open(); cmd.ExecuteNonQuery(); connect.Close(); }
public static void dodajSmenu(Smena s) { OleDbCommand cmd = new OleDbCommand("INSERT INTO Smena (Datum, IzborSmene, ID) VALUES(@Datum, @IzborSmene, @ID)", connect); cmd.Parameters.AddWithValue("@Datum", s.Datum); cmd.Parameters.AddWithValue("@IzborSmene", s.izborSmene); cmd.Parameters.AddWithValue("@ID", s.ID); connect.Open(); cmd.ExecuteNonQuery(); connect.Close(); }
public static void azurirajSmenu(Smena s) { OleDbCommand cmd = new OleDbCommand("UPDATE Smena SET [ID] = @ID WHERE [Datum] = @Datum AND [IzborSmene] = @IzborSmene", connect); cmd.Parameters.AddWithValue("@ID", s.ID); cmd.Parameters.AddWithValue("@Datum", s.Datum); cmd.Parameters.AddWithValue("@IzborSmene", s.izborSmene); connect.Open(); cmd.ExecuteNonQuery(); connect.Close(); }
public static DataTable SelectSmenuPoIDu(Smena s) { DataTable dt = new DataTable(); String sql = "SELECT * from Smena WHERE ID = @ID"; OleDbCommand cmd = new OleDbCommand(sql, connect); cmd.Parameters.AddWithValue("@ID", s.ID); OleDbDataAdapter adapter = new OleDbDataAdapter(cmd); connect.Open(); adapter.Fill(dt); connect.Close(); return(dt); }
public static DataTable SelectSmenu(Smena s) { DataTable dt = new DataTable(); String sql = "SELECT * from Smena WHERE Datum = @Datum AND [IzborSmene] = @IzborSmene"; OleDbCommand cmd = new OleDbCommand(sql, connect); cmd.Parameters.AddWithValue("@Datum", s.Datum); cmd.Parameters.AddWithValue("@IzborSmene", s.izborSmene); OleDbDataAdapter adapter = new OleDbDataAdapter(cmd); connect.Open(); adapter.Fill(dt); connect.Close(); return(dt); }