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


C# SQLite.SQLiteAsyncConnection类代码示例

本文整理汇总了C#中SQLite.SQLiteAsyncConnection的典型用法代码示例。如果您正苦于以下问题:C# SQLiteAsyncConnection类的具体用法?C# SQLiteAsyncConnection怎么用?C# SQLiteAsyncConnection使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


SQLiteAsyncConnection类属于SQLite命名空间,在下文中一共展示了SQLiteAsyncConnection类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: AddRecipesAsync

        private async Task AddRecipesAsync()
        {
            var list = await GetAllRecepiesFromHttpRequest();

            SQLiteAsyncConnection conn = new SQLiteAsyncConnection(dbName);
            await conn.InsertAllAsync(list);
        }
开发者ID:bellinda,项目名称:BonApetit-Rss-App,代码行数:7,代码来源:NoTimePage.xaml.cs

示例2: LoadAlbumViaName

 public async Task<AlbumItem> LoadAlbumViaName(int artistId, string albumName)
 {
     var connection = new SQLiteAsyncConnection(DbPath);
     var query = connection.Table<AlbumItem>().Where(x => x.Name.Equals(albumName)).Where(x => x.ArtistId == artistId);
     var result = await query.ToListAsync();
     return result.FirstOrDefault();
 }
开发者ID:robUx4,项目名称:vlc-winrt,代码行数:7,代码来源:AlbumDatabase.cs

示例3: ConnData

        private void ConnData()
        {
            //Creates database if it doesn't exists
            var dbPath = Path.Combine(Windows.Storage.ApplicationData.Current.LocalFolder.Path, "db.sqlite");

            conn = new SQLite.SQLiteAsyncConnection(dbPath);
        }
开发者ID:Tmutsaers,项目名称:HierInBreda,代码行数:7,代码来源:DataControl.cs

示例4: CreateDatabase

        private static Task CreateDatabase (SQLiteAsyncConnection connection, CancellationToken cancellationToken)
        {
            return Task.Factory.StartNew(() =>
            {
                //Create the tables
                var createTask = connection.CreateTablesAsync (tableTypes);
                createTask.Wait();

                //Count number of assignments
                var countTask = connection.Table<Assignment>().CountAsync();
                countTask.Wait();

                //If no assignments exist, insert our initial data
                if (countTask.Result == 0)
                {
                    var insertTask = connection.InsertAllAsync(TestData.All);

                    //Wait for inserts
                    insertTask.Wait();

                    //Mark database created
                    initialized = true;
                }
            });
        }
开发者ID:harouny,项目名称:prebuilt-apps,代码行数:25,代码来源:Database.cs

示例5: acbDrugSearch_TextChanged

        /// <summary>
        /// For Displaying search result from database
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private async void acbDrugSearch_TextChanged(object sender, RoutedEventArgs e)
        {

            var folder = ApplicationData.Current.LocalFolder.GetFolderAsync("DataFolder");

            SQLiteAsyncConnection conn = new SQLiteAsyncConnection(Path.Combine(ApplicationData.Current.LocalFolder.Path, "DataFile.sqlite"), true);
           

            string pillname = acbDrugSearch.Text;
            if (!string.IsNullOrEmpty(pillname) && !string.IsNullOrWhiteSpace(pillname) && pillname.Length > 3)
            {

                var query = conn.Table<drugs>().Where(x => x.drugname.Contains(pillname));
                var result = await query.ToListAsync();
                if (result == null)
                {
                    MessageBox.Show("Pill not found.");
                }
                else
                {
                    List<string> drugnamelist = new List<string>();
                    foreach (var item in result)
                    {
                        dataReadName =item.drugname;
                        dataReadMilligram = item.strenght;
                        dataReadNameMilligram = dataReadName + dataReadMilligram;
                        drugnamelist.Add(dataReadNameMilligram);
                    }
                    lstDrugSearch.ItemsSource = drugnamelist;
                }


            }
        }
开发者ID:EdytaSzkiladz,项目名称:MyLocalPharmacy,代码行数:39,代码来源:PillEditItem.xaml.cs

示例6: Create

        private async void Create()
        {
            Connection = new SQLiteAsyncConnection(dbpath);

            // create all tables
            Connection.CreateTableAsync<SQLite.Task>();
        }
开发者ID:kamaelyoung,项目名称:MultiPlatform,代码行数:7,代码来源:ServiceSQLite.cs

示例7: btnOK_Click

        private async void btnOK_Click(object sender, RoutedEventArgs e)
        {
            SQLiteAsyncConnection conn = new SQLiteAsyncConnection(Path.Combine(ApplicationData.Current.LocalFolder.Path, "people.db"), true);

            Person person = new Person
            {
                DoctorName = watermarkTextBox.Text,
                Date = datepick.ValueString,
                Time = timepick.ValueString
             };

            await conn.InsertAsync(person);

            //My_Medi.ViewModels.MainViewModel veiw = new ViewModels.MainViewModel();

            //veiw.LoadData();
            DataContext = App.ViewModel;
            App.ViewModel.Items.Clear();
            App.ViewModel.LoadData();            
            

            NavigationService.GoBack();
            
            


        }
开发者ID:ZytrixSathwikE,项目名称:Windows,代码行数:27,代码来源:Add_appointment.xaml.cs

示例8: AppBarToggleButton_Checked

        private void AppBarToggleButton_Checked(object sender, RoutedEventArgs e)
        {

            AppBarToggleButton favButton = sender as AppBarToggleButton;
            //if ((bool)favButton.IsChecked)
            //{
            //    var path = ApplicationData.Current.LocalFolder.Path + "/myDb1.DB";
            //    var con = new SQLiteAsyncConnection(path);
            //    //await con.InsertAllAsync(results);

            //    await con.QueryAsync<Result>(string.Format("insert into Result (name,name) values('{0}','{1}')", results[0].name, tblock.Text));
            //}
            //else
            //{

            //}
            if ((bool)favButton.IsChecked)
            {
                var path = ApplicationData.Current.LocalFolder.Path + "/myDb1.DB";
                var con = new SQLiteAsyncConnection(path);
                con.QueryAsync<Favourite>(string.Format("insert into Favourite (placeName,userName) values('{0}','{1}')", results[0].name, tblock.Text));
            }
            else if (!(bool)favButton.IsChecked)
            {
                var path = ApplicationData.Current.LocalFolder.Path + "/myDb1.DB";
                var con = new SQLiteAsyncConnection(path);
                con.QueryAsync<Favourite>(string.Format("delete from Favourite where placeName = '{0}' and username='{1}'", results[0].name, tblock.Text));
            }


        }
开发者ID:Bhargavi-Chirukuri,项目名称:DevMenITTasks,代码行数:31,代码来源:BlankPage1.xaml.cs

示例9: DeleteCounterAsync

        public async Task DeleteCounterAsync(Counter counter)
        {
            var connection = new SQLiteAsyncConnection(_dbPath);
            await connection.DeleteAsync(counter);

            OnCountersChanged();
        }
开发者ID:jimbobbennett,项目名称:StupendousCounter,代码行数:7,代码来源:DatabaseHelper.cs

示例10: btnOK_Click

        private async void btnOK_Click(object sender, RoutedEventArgs e)
        {

            SQLiteAsyncConnection conn = new SQLiteAsyncConnection(Path.Combine(ApplicationData.Current.LocalFolder.Path, "people.db"), true);
            //string[] per = new string[10];
 
            var per=App.ViewModel.Items[index];
            per.LineFive = watermarkTextBox.Text;
            per.Linesix = watermarkTextBox1.Text;
            per.Lineseven = watermarkTextBox2.Text;
            per.Lineeight = watermarkTextBox3.Text;
            Person person = new Person()

            {
                ID=per.Lineone,
                DoctorName=per.Linetwo,
                Date=per.Linethree,
                Time=per.LineFour,
                Temperature=per.LineFive,
                Bp=per.Linesix,
                symptoms=per.Lineseven,
                description=per.Lineeight

            };
           
            await conn.UpdateAsync(person);


            NavigationService.GoBack();
            
        }
开发者ID:ZytrixSathwikE,项目名称:Windows,代码行数:31,代码来源:Prescription.xaml.cs

示例11: CounterSubscribed

 public async static Task<int> CounterSubscribed()
 {
     SQLiteAsyncConnection sqlConnection = new SQLiteAsyncConnection(DbHelper.DB_PATH);
     int counters = await sqlConnection.Table<Counter>().CountAsync();
     AppStore.AddValue(Constants.CountersSubscribed, counters.ToString());
     return counters;
 }
开发者ID:maskaravivek,项目名称:FoodMenu,代码行数:7,代码来源:CounterStore.cs

示例12: Button_Click_3

 private async void Button_Click_3(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();
     listbox.ItemsSource = result;
 }
开发者ID:peepo3663,项目名称:WindowsPhone8,代码行数:7,代码来源:MainPage.xaml.cs

示例13: LoadViaArtistName

 async Task<MusicLibraryViewModel.ArtistItem> LoadViaArtistName(string artistName)
     {
         var connection = new SQLiteAsyncConnection(_dbPath);
         var query = connection.Table<MusicLibraryViewModel.ArtistItem>().Where(x => x.Name.Equals(artistName));
         var result = await query.ToListAsync();
         return result.FirstOrDefault();
     }
开发者ID:kusl,项目名称:vlcwinrt,代码行数:7,代码来源:ArtistDataRepository.cs

示例14: GetFirstTrackPathByAlbumId

 public async Task<string> GetFirstTrackPathByAlbumId(int albumId)
 {
     var connection = new SQLiteAsyncConnection(DbPath);
     var query = connection.Table<TrackItem>().Where(x => x.AlbumId == albumId);
     var result = await query.FirstOrDefaultAsync();
     return result != null ? result.Path : null;
 }
开发者ID:robUx4,项目名称:vlc-winrt,代码行数:7,代码来源:TrackDatabase.cs

示例15: OnNavigatedTo

        /// <summary>
        /// Invoked when this page is about to be displayed in a Frame.
        /// </summary>
        /// <param name="e">Event data that describes how this page was reached.
        /// This parameter is typically used to configure the page.</param>
        protected async override void OnNavigatedTo(NavigationEventArgs e)
        {

            bool dbExist = await CheckDbAsync("Tips.db3");
            if (!dbExist)
            {
                await CreateDatabaseAsync();
            }

         
            SQLiteAsyncConnection conn = new SQLiteAsyncConnection("Tips.db3");
            var query = conn.Table<Tips>();
            tips = await query.ToListAsync();

            string title1res = tips[tips.Count - 1].title1;
            string title2res = tips[tips.Count - 1].title2;
            string title3res = tips[tips.Count - 1].title3;
            
            string desc1res = tips[tips.Count - 1].desc1;
            string desc2res = tips[tips.Count - 1].desc2;
            string desc3res = tips[tips.Count - 1].desc3;


            Tips l = new Tips { title1 = title1res, title2 = title2res, title3 = title3res, desc1 = desc1res, desc2 = desc2res, desc3 = desc3res };
            t.Add(l);
            TipsList.ItemsSource = t;
        }
开发者ID:karim-raz,项目名称:cali-health-coach-wp,代码行数:32,代码来源:Tipspage.xaml.cs


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