public static void Remove_StarredItem(StarredDataSQL starred) { using (var db = new SQLite.SQLiteConnection(SQLDBPath)) { SQLiteCommand cmd = db.CreateCommand(string.Format("DELETE from StarredDataSQL WHERE StarredTitle = \"{0}\"", starred.StarredTitle)); List <StarredDataSQL> result = cmd.ExecuteQuery <StarredDataSQL>(); } }
public static void Insert_StarredItem(StarredDataSQL starred) { if (SQLDBPath == null) { throw new Exception("SQL is not init yet, please call 'LoadSQLTableData()'."); } using (SQLiteConnection db = new SQLiteConnection(SQLDBPath)) { SQLiteCommand cmd = db.CreateCommand(string.Format("SELECT * from StarredDataSQL WHERE ID='{0}' LIMIT 1", starred.ID)); List <StarredDataSQL> result = cmd.ExecuteQuery <StarredDataSQL>(); if (result.Count == 0) { db.RunInTransaction(() => { db.Insert(starred); }); } } }