public void delete(Object o) { try { Projekt p = (Projekt)o; OleDbCommand cmd = con.CreateCommand(); cmd.CommandText = "Delete from Files where Name = '" + p.Name + "'"; OpenConnection(); cmd.ExecuteNonQuery(); con.Close(); } catch (Exception) { throw; } }
private Projekt mkDokumentObject(OleDbDataReader reader, int i) { Projekt wd = new Projekt(); try { wd.Id = Convert.ToInt32(pruefen(reader[i++])); wd.Name = Convert.ToString(pruefen(reader[i++])); wd.ErstellDatum = Convert.ToDateTime(pruefen(reader[i++])); wd.Dateiart = Convert.ToString(pruefen(reader[i++])); } catch (Exception) { } return(wd); }
public List <Projekt> openDatabase() { OleDbCommand cmd = con.CreateCommand(); cmd.CommandText = "Select * from Files"; OpenConnection(); reader = cmd.ExecuteReader(); int i = 0; while (reader.Read()) { Projekt wd = mkDokumentObject(reader, i); lstDoku.Add(wd); } reader.Close(); con.Close(); return(lstDoku); }
public List <Projekt> ExcelAnzeigen() { try { List <Projekt> Liste = new List <Projekt>(); OleDbCommand cmd = con.CreateCommand(); cmd.CommandText = "Select * from Files where dateiart = 'excel'"; OpenConnection(); reader = cmd.ExecuteReader(); int i = 0; while (reader.Read()) { Projekt wd = mkDokumentObject(reader, i); Liste.Add(wd); } reader.Close(); con.Close(); return(Liste); } catch (Exception) { throw; } }