当前位置: 首页>>代码示例>>C#>>正文


C# SQLiteAsyncConnection.DeleteAsync方法代码示例

本文整理汇总了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();
        }
开发者ID:jimbobbennett,项目名称:StupendousCounter,代码行数:7,代码来源:DatabaseHelper.cs

示例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);
     }
 }
开发者ID:maskaravivek,项目名称:FoodMenu,代码行数:9,代码来源:ItemStore.cs

示例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);
 }
开发者ID:robUx4,项目名称:vlc-winrt,代码行数:10,代码来源:TrackCollectionDatabase.cs

示例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);
     }
 }
开发者ID:peepo3663,项目名称:WindowsPhone8,代码行数:10,代码来源:MainPage.xaml.cs

示例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();
 }
开发者ID:maskaravivek,项目名称:FoodMenu,代码行数:10,代码来源:CounterStore.cs

示例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;
     }
 }
开发者ID:Fanuer,项目名称:fitnessApp,代码行数:21,代码来源:LocalDB.cs

示例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);
            }
        }
开发者ID:tungnt92,项目名称:MoneyBookWP,代码行数:12,代码来源:MainPage.xaml.cs

示例8: Remove

 public Task Remove(ArtistItem artist)
 {
     var connection = new SQLiteAsyncConnection(DbPath);
     return connection.DeleteAsync(artist);
 }
开发者ID:robUx4,项目名称:vlc-winrt,代码行数:5,代码来源:ArtistDatabase.cs

示例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);
            }
        }
开发者ID:tungnt92,项目名称:MoneyBookWP,代码行数:12,代码来源:editGhichep.xaml.cs

示例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);
            }

        }
开发者ID:hMatoba,项目名称:PlaneAudioU,代码行数:88,代码来源:MainPage.xaml.cs

示例11: DeleteVisit

		public async Task<int> DeleteVisit(Visit visit) {
			SQLiteAsyncConnection conn = new SQLiteAsyncConnection(this.dbPath);
			return await conn.DeleteAsync(visit);
		}
开发者ID:jarwol,项目名称:WheredWeEat-CS,代码行数:4,代码来源:SQLiteAPI.cs

示例12: DeleteDB

 public async void DeleteDB(DB data)
 {
     SQLiteAsyncConnection conn = new SQLiteAsyncConnection("exercice");
     await conn.DeleteAsync(data);
 }
开发者ID:Coyotealone,项目名称:Exercice-Vigenere,代码行数:5,代码来源:Fonctions.cs

示例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();

            

        }
开发者ID:jkisicki,项目名称:eFiszki_Project,代码行数:56,代码来源:UsunSlowko.xaml.cs

示例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);
            }

        }
开发者ID:Robotonics,项目名称:iotSampler,代码行数:15,代码来源:MainPage.xaml.cs

示例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);
            }
        }
开发者ID:luiseduardohdbackup,项目名称:Windows-Universal,代码行数:12,代码来源:MainPage.xaml.cs


注:本文中的SQLite.SQLiteAsyncConnection.DeleteAsync方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。