本文整理汇总了C#中SQLite.SQLiteAsyncConnection.DeleteAsync方法的典型用法代码示例。如果您正苦于以下问题:C# SQLiteAsyncConnection.DeleteAsync方法的具体用法?C# SQLiteAsyncConnection.DeleteAsync怎么用?C# SQLiteAsyncConnection.DeleteAsync使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SQLite.SQLiteAsyncConnection
的用法示例。
在下文中一共展示了SQLiteAsyncConnection.DeleteAsync方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DeleteCounterAsync
public async Task DeleteCounterAsync(Counter counter)
{
var connection = new SQLiteAsyncConnection(_dbPath);
await connection.DeleteAsync(counter);
OnCountersChanged();
}
示例2: DeleteItems
public async static Task DeleteItems(int menuId)
{
SQLiteAsyncConnection sqlConnection = new SQLiteAsyncConnection(DbHelper.DB_PATH);
var collectionItem = await sqlConnection.Table<Item>().Where(x => x.MenuId == menuId).ToListAsync();
foreach(Item item in collectionItem)
{
await sqlConnection.DeleteAsync(item);
}
}
示例3: Remove
public async Task Remove(TrackCollection trackCollection)
{
var connection = new SQLiteAsyncConnection(DbPath);
var loadTracks = await Locator.MusicLibraryVM.TracklistItemRepository.LoadTracks(trackCollection);
foreach (TracklistItem tracklistItem in loadTracks)
{
await Locator.MusicLibraryVM.TracklistItemRepository.Remove(tracklistItem);
}
await connection.DeleteAsync(trackCollection);
}
示例4: Button_Click_4
private async void Button_Click_4(object sender, RoutedEventArgs e)
{
SQLiteAsyncConnection conn = new SQLiteAsyncConnection(ApplicationData.Current.LocalFolder.Path + "\\people.db");
var query = conn.Table<Person>().Where(x => x.Name == "张三");
var result = await query.ToListAsync();
foreach (var item in result)
{
await conn.DeleteAsync(item);
}
}
示例5: DeleteCounter
public async static Task DeleteCounter(int counterId)
{
SQLiteAsyncConnection sqlConnection = new SQLiteAsyncConnection(DbHelper.DB_PATH);
var collectionItem = await sqlConnection.Table<Counter>().Where(x => x.Id == counterId).FirstOrDefaultAsync();
if (collectionItem != null)
{
await sqlConnection.DeleteAsync(collectionItem);
}
await CounterSubscribed();
}
示例6: deleteSchedule
/// <summary>
/// Löscht einen Trainingsplan aus der lokalen DB
/// </summary>
/// <param name="data">Schedule</param>
/// <param name="path">SQLite Connection String</param>
/// <returns>1 -> Delete</returns>
/// <returns>-1 -> Exception</returns>
public async Task<int> deleteSchedule(Schedule data)
{
try
{
var db = new SQLiteAsyncConnection(path);
await db.DeleteAsync(data);
return 1;
}
catch (SQLiteException ex)
{
Console.WriteLine(ex.Message);
return -1;
}
}
示例7: DeletetaisanAsync
private async Task DeletetaisanAsync(string name)
{
SQLiteAsyncConnection conn = new SQLiteAsyncConnection("moneybook.db");
// Retrieve taisan
var taisan = await conn.Table<taikhoan>().Where(x => x.Tentaikhoan == name).FirstOrDefaultAsync();
if (taisan != null)
{
// Delete record
await conn.DeleteAsync(taisan);
}
}
示例8: Remove
public Task Remove(ArtistItem artist)
{
var connection = new SQLiteAsyncConnection(DbPath);
return connection.DeleteAsync(artist);
}
示例9: DeleteGhichepAsync
private async Task DeleteGhichepAsync(int oldid)
{
SQLiteAsyncConnection conn = new SQLiteAsyncConnection("moneybook.db");
// Retrieve taisan
var pv = await conn.Table<ghichep>().Where(x => x.Id == oldid).FirstOrDefaultAsync();
if (pv != null)
{
// Delete record
await conn.DeleteAsync(pv);
}
}
示例10: PickAlbumsFromDir
async Task PickAlbumsFromDir()
{
var now = DateTime.Now;
var albumFolders = await KnownFolders.MusicLibrary.GetFoldersAsync(Windows.Storage.Search.CommonFolderQuery.GroupByArtist);
foreach (var albumFolder in albumFolders)
{
Debug.WriteLine(albumFolder.Name);
var files = from b in await albumFolder.GetFilesAsync()
where !b.Path.EndsWith(".jpg")
select b;
var propDict = (from b in files
select new { b.Properties.GetMusicPropertiesAsync().AsTask().Result,
Value = b }
).ToDictionary(b => b.Result, b => b.Value);
var musicProperties = from b in propDict.Keys
orderby b.TrackNumber
group b by b.Album;
var albumPool = new List<Album>() { };
foreach (var tracks in musicProperties)
{
var props = tracks.ToList();
var paths = (from b in props
select propDict[b].Path).ToList();
var yearDesc = 10000 - props[0].Year;
var albumID = $"{props[0].Artist} {yearDesc} {props[0].Album}";
var db1 = new SQLiteAsyncConnection("PlaneAudioU.db");
var album = await db1
.Table<Album>()
.Where(a => a.AlbumID == albumID)
.FirstOrDefaultAsync();
var albumNew = new Album()
{
AlbumID = albumID,
Title = props[0].Album,
Artist = props[0].Artist,
Titles = props.Select(a => a.Title).ToList(),
TrackPaths = paths,
Length = props.Count(),
Added = now
};
var db2 = new SQLiteAsyncConnection("PlaneAudioU.db");
if (album == null)
{
await db2.InsertAsync(albumNew);
}
else
{
await db2.UpdateAsync(albumNew);
}
albumPool.Add(albumNew);
}
Debug.WriteLine("album pool. " + albumPool.Count.ToString());
if (albumPool.Count() > 0)
{
var albumToShow = (from a in albumPool
where !shownAlbums.Contains(a.AlbumID)
select a).ToList();
if (albumToShow.Count() > 0)
{
var artistRect = GetArtistRect(albumToShow[0].Artist);
albumPanel.Items.Add(artistRect);
foreach (var album in albumToShow.OrderBy(a => a.AlbumID))
{
var button = await album.GetButton();
button.Click += AlbumButton_Clicked;
albumPanel.Items.Add(button);
shownAlbums.Add(album.AlbumID);
}
}
}
}
Debug.WriteLine("Saving to db.");
var db3 = new SQLiteAsyncConnection("PlaneAudioU.db");
foreach (var oldAlbum in await db3.Table<Album>().Where(a => now > a.Added).ToListAsync())
{
var db4 = new SQLiteAsyncConnection("PlaneAudioU.db");
await db4.DeleteAsync(oldAlbum);
}
}
示例11: DeleteVisit
public async Task<int> DeleteVisit(Visit visit) {
SQLiteAsyncConnection conn = new SQLiteAsyncConnection(this.dbPath);
return await conn.DeleteAsync(visit);
}
示例12: DeleteDB
public async void DeleteDB(DB data)
{
SQLiteAsyncConnection conn = new SQLiteAsyncConnection("exercice");
await conn.DeleteAsync(data);
}
示例13: Button_Click_1
private async void Button_Click_1(object sender, RoutedEventArgs e)
{
string baza = comboboxusunzbazy.SelectedValue.ToString();
string slowko = comboboxslowkodousuniecia.SelectedValue.ToString();
string[] tablica = slowko.Split(new[] {'.'});
if (baza.Equals("eFiszki"))
{
baza = "AppData";
}
var path = Windows.Storage.ApplicationData.Current.LocalFolder.Path + @"\" + baza + ".sqlite";
var db = new SQLiteAsyncConnection(path);
var maxid = 0;
List<UserDefaultDataBase> result = await db.QueryAsync<UserDefaultDataBase>("Select max(id) as Id From UserDefaultDataBase");
foreach (var item in result)
{
maxid = item.Id;
}
int indeksdousuniecia = Convert.ToInt32(tablica[0]);
var all = await db.QueryAsync<UserDefaultDataBase>("Select * From UserDefaultDataBase");
var del = await db.FindAsync<UserDefaultDataBase>(u => u.Id == indeksdousuniecia);
await db.DeleteAsync(del);
//Debug.WriteLine("maksymalny indeks: " + maxid + ", indeks do usuniecia:" + indeksdousuniecia);
//if (maxid != indeksdousuniecia)
//{
// List<UserDefaultDataBase> updateid = await db.QueryAsync<UserDefaultDataBase>("Select * From UserDefaultDataBase Where Id = ?", new object[] { maxid });
// var update = updateid.First();
// update.Id += 100;
// update.SlowkoEn = "toz to dziala";
// await db.UpdateAsync(update);
// Debug.WriteLine("Update indeksu:" + maxid + " na " + indeksdousuniecia);
// //foreach (var i in updateid)
// //{
// // Debug.WriteLine(i.Id);
// //}
// //await db.QueryAsync<UserDefaultDataBase>("Update UserDefaultDataBase set id= ? where id=?", new object[] {maxid, indeksdousuniecia });
// //foreach (var i in updateid)
// //{
// // var update = updateid.First();
// // update.Id = indeksdousuniecia;
// // await db.UpdateAsync(update);
// //}
//}
comboboxslowkodousuniecia.Items.Clear();
setcomboslowko();
}
示例14: Delete
/// <summary>
/// Delete a record
/// </summary>
public async void Delete(string sensor)
{
SQLiteAsyncConnection connection = new SQLiteAsyncConnection(textBox.Text);
var SensorQry = await connection.Table<Sensor>().Where(x => x.Name.StartsWith(sensor)).FirstOrDefaultAsync();
if (SensorQry != null)
{
await connection.DeleteAsync(SensorQry);
}
}
示例15: DeleteArticleAsync
private async Task DeleteArticleAsync(string name)
{
SQLiteAsyncConnection conn = new SQLiteAsyncConnection(dbName);
// Retrieve Article
var article = await conn.Table<Article>().Where(x => x.Title == name).FirstOrDefaultAsync();
if (article != null)
{
// Delete record
await conn.DeleteAsync(article);
}
}