public bool AddImenik(Imeniki toAdd) { using (SQLiteCommand com = new SQLiteCommand(con)) { com.CommandText = "INSERT into imeniki (Name)" + "VALUES ('" + toAdd.PhoneBook + "')"; //SQL STAVEK com.ExecuteNonQuery(); com.Dispose(); } return(true); }
public Imeniki ShowImeniki(Imeniki toShow) { Imeniki toReturn = null; using (SQLiteCommand com = new SQLiteCommand(con)) { com.CommandText = "SELECT id, ime FROM imeniki";//SQL STAVEK using (SQLiteDataReader reader = com.ExecuteReader()) while (reader.HasRows) { reader.Read(); toReturn = new Imeniki(reader.GetInt32(0), reader.GetString(1)); // Imeniki(int phonebook_id, string phonebook) } com.Dispose(); } return(toReturn); }