public bool UpdateData(Anime anime, dataType type = 0) { SQLiteCommand command = new SQLiteCommand(string.Format("UPDATE {0} SET content=@content WHERE episodeurl=@episodeurl", type.ToString()), con); command.Parameters.AddWithValue("content", anime.ToString()); command.Parameters.AddWithValue("episodeurl", anime.episode.episodeurl); Trace.WriteLine(command.CommandText + command.Parameters.ToString()); int rows = command.ExecuteNonQuery(); return(rows > 0); }
public void AddData(Anime anime, dataType datatype = 0) { anime.episodes = null; //string data = Enum.GetName(typeof(dataType), datatype); string data = datatype.ToString(); SQLiteCommand command = new SQLiteCommand(string.Format("INSERT INTO {0}(content,episodeurl) VALUES(@content,@episodeurl)", data), con); command.Parameters.AddWithValue("content", anime.ToString()); command.Parameters.AddWithValue("episodeurl", anime.episode.episodeurl); try { command.ExecuteNonQuery(); } catch (Exception) { } }