本文整理汇总了C#中SQLite.SQLiteConnection.Delete方法的典型用法代码示例。如果您正苦于以下问题:C# SQLiteConnection.Delete方法的具体用法?C# SQLiteConnection.Delete怎么用?C# SQLiteConnection.Delete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SQLite.SQLiteConnection
的用法示例。
在下文中一共展示了SQLiteConnection.Delete方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DeleteAccountFromAllTables
/// <summary>
/// Deletes the account from all tables.
/// </summary>
/// <param name="id">Identifier for the account..</param>
public void DeleteAccountFromAllTables(int id)
{
SQLiteConnection con = new SQLiteConnection(ServerConstants.DB_PATH);
con.Delete<TableAccount>(id);
con.Delete<TableBuilding>(id);
con.Delete<TableResource>(id);
con.Delete<TableUnit>(id);
}
示例2: DeletePassword
public void DeletePassword(PasswordItem _selectedPasswordItem)
{
using (SQLiteConnection context = new SQLiteConnection(_connectionString))
{
context.Delete(_selectedPasswordItem);
}
}
示例3: DeleteWeighingEntry
public void DeleteWeighingEntry(Weighing selectedWeighing)
{
using (var dbConn = new SQLiteConnection(App.DB_PATH))
{
dbConn.Delete(selectedWeighing);
}
}
示例4: DeleteLogEntry
public void DeleteLogEntry(LogEntry selectedLogEntry)
{
using (var dbConn = new SQLiteConnection(App.DB_PATH))
{
dbConn.Delete(selectedLogEntry);
}
}
示例5: DeleteExercise
public void DeleteExercise(Exercise myExercise)
{
using (var dbConn = new SQLiteConnection(App.DB_PATH))
{
dbConn.Delete(myExercise);
}
}
示例6: EemaldaKontakt
public int EemaldaKontakt(int id, SQLiteConnection c)
{
Kontakt[] k = this.otsiKontaktid(new Kontakt() { Id = id }, c);
if (k.Length > 0)
{
return c.Delete(k[0]);
}
return 0;
}
示例7: DeleteObject
public void DeleteObject(Notes note)
{
using (var db = new SQLiteConnection(dbPath))
{
var existing = db.Query<Notes>("select * from Notes where id = " + note.ID).FirstOrDefault();
db.RunInTransaction(() =>
{
db.Delete(note);
});
}
}
示例8: DeleteLogEntriesByExerciseId
public void DeleteLogEntriesByExerciseId(int id)
{
using (var dbConn = new SQLiteConnection(App.DB_PATH))
{
ObservableCollection<LogEntry> lstLogEntries = GetLogEntries(id);
foreach (var item in lstLogEntries)
{
dbConn.Delete(item);
}
}
}
示例9: DeleteBeacon
//Delete a Beacon
public static int DeleteBeacon(int bID)
{
try
{
var db = new SQLiteConnection(dbPath);
var result = db.Delete<Beacons>(bID);
return result;
}
catch (Exception exc)
{
return -1;
}
}
示例10: DeleteTactic
public int DeleteTactic(Tactic tactic)
{
int rs = -1;
using (var db = new SQLiteConnection(this.Path, this.State))
{
var existing = db.Query<Tactic>("SELECT * FROM Tactic WHERE ID=?", tactic.Id).FirstOrDefault();
if (existing != null)
{
db.RunInTransaction(() =>
{
rs = db.Delete(existing);
});
}
}
return rs;
}
示例11: DeleteUser
public int DeleteUser(User user)
{
int rs = -1;
using (var db = new SQLiteConnection(this.Path, this.State))
{
var existing = db.Query<User>("SELECT * FROM User WHERE ID=?", user.Id).FirstOrDefault();
if (existing != null)
{
db.RunInTransaction(() =>
{
rs = db.Delete(existing);
});
}
}
return rs;
}
示例12: SetUp
public void SetUp()
{
//var pathToDb = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "sessions.db");
//var conn = new SQLiteConnection(pathToDb);
//if (!File.Exists(pathToDb))
//{
// File.Copy("sessions.db", pathToDb);
//}
db = new DatabaseFactory().InitDb();
// Empty test Tasks
var tasks = (from t in db.Table<Task>() select t);
foreach (var task in tasks)
{
db.Delete(task);
}
}
示例13: createSystemUser
//-----------sets an fake user for recognizing if welcome screen should be ignored or not---------//
protected void createSystemUser()
{
var db = new SQLiteConnection (dbPath);
var rowCount = db.Table<User> ().Count ();
if (rowCount > 2) {
db.DeleteAll<User> ();
}
if (!hasInserted) {
Log.Info (Tag, "libber");
var result = insertUpdateData(new User{ ID = 2, FirstName = string.Format("SystemUser", System.DateTime.Now.Ticks),
LastName = "Mr.Anderson",
}, db);
hasInserted = true;
} else {
var rowcount = db.Delete(new User(){ID=2});
}
}
示例14: OnCreate
protected override void OnCreate(Bundle bundle)
{
base.OnCreate (bundle);
// Set our view from the "main" layout resource
SetContentView (Resource.Layout.Main);
// Get our button from the layout resource,
// and attach an event to it
Button button = FindViewById<Button> (Resource.Id.myButton);
string folder = System.Environment.GetFolderPath (System.Environment.SpecialFolder.Personal);
var db = new SQLiteConnection (System. IO. Path. Combine (folder, "myDb. db"));
button.Click += delegate{
Person Person = new Person{ Name = FindViewById<EditText> (Resource.Id.editText1).Text };
int id = db.Insert(Person);
FindViewById<TextView> (Resource.Id.textView2).Text = "Inserted with success: id "+id;
};
Button deleteButton = FindViewById<Button> (Resource.Id.button2);
deleteButton.Click += delegate {
var DeletedId = db.Delete<Person> (Convert.ToInt32(FindViewById<EditText> (Resource.Id.editText1).Text));
FindViewById<TextView> (Resource.Id.textView2).Text = "Id " + Dele tedId + "Deleted With Success";
};
db.Commit();
db.Rollback();
}
示例15: FootballPlayerViewModel
public FootballPlayerViewModel()
{
this.SaveCommand = new Command (() => {
});
this.FavouriteCommand = new Command<FootballPlayerViewModel> (execute: (FootballPlayerViewModel theplayer) => {
using ( SQLiteConnection connection = new SQLiteConnection (Path.Combine (App.folderPath, "FootballPlayerDB.db3"))) {
List<FootballPlayer> newplayerlist = connection.Query<FootballPlayer> ("SELECT * FROM FootballPlayer WHERE FirstName = ? and LastName = ?", theplayer.FirstName, theplayer.LastName);
newplayerlist [0].Isfavourite = !(newplayerlist [0].Isfavourite);
connection.Update (newplayerlist [0]);
}
MessagingCenter.Send(this,"DBChanged");
});
this.DeleteCommand = new Command<FootballPlayerViewModel> (execute: (FootballPlayerViewModel theplayer) => {
using (SQLiteConnection connection = new SQLiteConnection (Path.Combine (App.folderPath, "FootballPlayerDB.db3"))) {
List<FootballPlayer> newplayerlist = connection.Query<FootballPlayer> ("SELECT * FROM FootballPlayer WHERE FirstName = ? and LastName = ?", theplayer.FirstName, theplayer.LastName);
connection.Delete (newplayerlist [0]);
}
MessagingCenter.Send(this,"DBChanged");
});
}