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


C# SQLiteAsyncConnection.CreateTableAsync方法代码示例

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


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

示例1: Create

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

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

示例2: CheckAndCreateDatabase

 public async static void CheckAndCreateDatabase()
 {
     if (!await FileUtils.CheckFileExists(DbHelper.DB_NAME))
     {
         System.Diagnostics.Debug.WriteLine("creating tables");
         SQLiteAsyncConnection conn = new SQLiteAsyncConnection(DB_PATH);
         await conn.CreateTableAsync<Organization>();
         await conn.CreateTableAsync<Counter>();
         await conn.CreateTableAsync<Menu>();
         await conn.CreateTableAsync<Item>();
     }
     else
     {
         System.Diagnostics.Debug.WriteLine("tables exist");
     }
 }
开发者ID:maskaravivek,项目名称:FoodMenu,代码行数:16,代码来源:DbHelper.cs

示例3: loadData

        private async void loadData()
        {
            //SQLiteAsyncConnection conn1 = new SQLiteAsyncConnection(System.IO.Path.Combine(ApplicationData.Current.LocalFolder.Path, "Appointment.db"), true);

            
            SQLiteAsyncConnection conn = new SQLiteAsyncConnection(System.IO.Path.Combine(ApplicationData.Current.LocalFolder.Path, "Appointment.db"), true);
            conn.DropTableAsync<SampleAppointment>();

            await conn.CreateTableAsync<SampleAppointment>();

            DateTime temp = DateTime.Now;

            DateTime start = DateTime.Parse("06/08/2013 6:00 PM");
            DateTime end = DateTime.Parse("06/09/2013 6:00 PM");

            SampleAppointment appointment1 = new SampleAppointment
            {
                Subject = "MACF - App Camp",
                AdditionalInfo = "BRTN 291, RSVP Reguired",
                StartDate = start,
                EndDate = end
            };

            conn.InsertAsync(appointment1);

            SampleAppointment appointment2 = new SampleAppointment
            {
                StartDate = DateTime.Now.AddMinutes(30),
                EndDate = DateTime.Now.AddHours(1),
                Subject = "Appointment 376",
                AdditionalInfo = "Info 3"
            };

            conn.InsertAsync(appointment2);

            start = DateTime.Parse("06/05/2013 5:00 PM");
            end = DateTime.Parse("06/05/2013 6:00 PM");
            SampleAppointment appointment3 = new SampleAppointment
            {
                StartDate = DateTime.Now.AddHours(2),
                EndDate = DateTime.Now.AddHours(3),
                Subject = "Appointment uhy4",
                AdditionalInfo = "Info 4"
            };

            conn.InsertAsync(appointment3);

            SampleAppointment appointment4 = new SampleAppointment
            {
                Subject = "Malaysian Night",
                AdditionalInfo = "STEW Common, Members Only",
                StartDate = start,
                EndDate = end
            };

            conn.InsertAsync(appointment4);

            //this.OnDataLoaded();
        }
开发者ID:KIshen90,项目名称:FreeFoodEngine,代码行数:59,代码来源:CalendarPage.xaml.cs

示例4: CreateDatabase

        public async void CreateDatabase()
        {
            SQLiteAsyncConnection conn = new SQLiteAsyncConnection(Path.Combine(ApplicationData.Current.LocalFolder.Path, "User.db"), true);
            await conn.CreateTableAsync<User>();

            SQLiteAsyncConnection conn1 = new SQLiteAsyncConnection(Path.Combine(ApplicationData.Current.LocalFolder.Path, "Appointment.db"), true);
            await conn1.CreateTableAsync<Appointment>();

        }
开发者ID:KIshen90,项目名称:FreeFoodEngine,代码行数:9,代码来源:MainPage.xaml.cs

示例5: UnicodePathsAsync

		public void UnicodePathsAsync()
		{
			var path = Path.GetTempFileName () + UnicodeText;
			
			var db = new SQLiteAsyncConnection (path, true);
			db.CreateTableAsync<OrderLine> ().Wait ();

			Assert.That (new FileInfo (path).Length, Is.GreaterThan (0), path);
		}
开发者ID:JammySoft,项目名称:sqlite-net,代码行数:9,代码来源:OpenTests.cs

示例6: connectDB

        async Task<int> connectDB()
        {
            var path = Windows.Storage.ApplicationData.Current.LocalFolder.Path + @"\beyondvincent.db";

            db = new SQLiteAsyncConnection(path);
            await db.DropTableAsync<User>();
            await db.CreateTableAsync<User>();
            return 0;
        }
开发者ID:BeyondVincent,项目名称:WindowsStoreAppCode,代码行数:9,代码来源:MainPage.xaml.cs

示例7: App

		public App (string dbPath)
		{
			// set up the database
			db = new SQLiteAsyncConnection (dbPath);
			db.CreateTableAsync<TaskItem> ().Wait ();

			// The root page of your application
			MainPage = new NavigationPage (new TasksPage (db));
		}
开发者ID:RomeroAlesander,项目名称:DC-Encyclopedia-Android,代码行数:9,代码来源:SQLiteSample.cs

示例8: ConnectToDatabase

        public async static Task<SQLiteAsyncConnection> ConnectToDatabase()
        {
            var databaseConnection = new SQLiteAsyncConnection(DatabaseFileName, SQLiteOpenFlags.ReadWrite | SQLiteOpenFlags.Create | SQLiteOpenFlags.NoMutex);

            var version = "1.3";
            var oldVersion = ApplicationSettings.DatabaseCreationVersion.Read();
            if (oldVersion != version)
            {
                await databaseConnection.CreateTableAsync<Song>();
                await databaseConnection.CreateTableAsync<SongGenre>();
                await databaseConnection.CreateTableAsync<Genre>();

                await databaseConnection.CreateTableAsync<CachedAlbumCover>();
                await databaseConnection.CreateTableAsync<CurrentPlaylistSong>();
                await databaseConnection.CreateTableAsync<SavedPlaylistSong>();
                await databaseConnection.CreateTableAsync<SavedPlaylist>();

                necessaryUpdatesForLibrary = new List<Func<MusicLibrary, Task>>();
                ApplicationSettings.IsDatabaseSettingUp.Save(true);
                if (oldVersion == "1.0" || oldVersion == "1.1" || oldVersion == "1.3")
                {
                     necessaryUpdatesForLibrary.Add(async library =>
                     {
                         foreach (var song in library.Songs)
                         {
                             try
                             {
                                 var storageFile = await StorageFile.GetFileFromPathAsync(song.FileName);
                                 TagLib.Tag tag = null;
                                 using (var stream = await storageFile.OpenStreamForReadAsync())
                                 {
                                     tag = await Task<TagLib.File>.Run(() =>
                                     {
                                         try
                                         {
                                             return TagLib.File.Create(new TagLib.StreamFileAbstraction(storageFile.Name, stream, null)).Tag;
                                         }
                                         catch { return null; }
                                     });
                                 }

                                 if (tag != null)
                                 { 
                                     library.localLibrarySource.UpdateSongMetadata(tag, song);
                                     await library.databaseConnection.UpdateAsync(song);
                                 }
                             }
                             catch { }
                         }
                     });
                }

                necessaryUpdatesForLibrary.Add(async library => { ApplicationSettings.DatabaseCreationVersion.Save(version); await Task.Delay(0); });

            }


            return databaseConnection;
        }
开发者ID:JulianMH,项目名称:music-3,代码行数:59,代码来源:MusicLibrary.cs

示例9: createFavouritesTable

 private static async void createFavouritesTable()
 {
     String path = ApplicationData.Current.LocalFolder.Path + "/OCTranspo.sqlite";
     SQLiteAsyncConnection conn = new SQLiteAsyncConnection(path);
     var count = await conn.ExecuteScalarAsync<int>("SELECT COUNT(*) FROM sqlite_master WHERE type='table' AND name='OCDirection'");
     if (count == 0)
     {
         await conn.CreateTableAsync<OCDirection>();
     }
 }
开发者ID:jules2689,项目名称:OCTranspoWP8,代码行数:10,代码来源:OCTranspoStopsData.cs

示例10: insertProduct

        public static async void insertProduct(Product product)
        {
            SQLiteAsyncConnection conn = new SQLiteAsyncConnection(PRODUCTS_TABLE);

            await conn.CreateTableAsync<Product>();

            await conn.InsertAsync(product);


        }
开发者ID:vlddamian2,项目名称:doi,代码行数:10,代码来源:DBEngine.cs

示例11: getExamsAsync

 public static async Task<List<Exam>> getExamsAsync()
 {
     if (exams.Count != 0)
     {
         return exams;
     }
     SQLiteAsyncConnection conn = new SQLiteAsyncConnection(Windows.Storage.ApplicationData.Current.LocalFolder.Path + "\\Data.db");
     await conn.CreateTableAsync<Exam>();
     exams = await conn.Table<Exam>().OrderBy(exam => exam.ExamTime).ToListAsync();
     return exams;
 }
开发者ID:CuiXiaoDao,项目名称:ZJUTimetable,代码行数:11,代码来源:Grades.cs

示例12: HouseImageCacheRepository

		public HouseImageCacheRepository ()
		{
			string folder = Environment.GetFolderPath (Environment.SpecialFolder.Personal);
			db = new SQLiteAsyncConnection (System.IO.Path.Combine (folder, "houseImages.db"));
//			db.DropTableAsync<HouseImages> ().ContinueWith (t => {
//				Console.WriteLine ("Table Dropped!");
//			});
			db.CreateTableAsync<HouseImages>().ContinueWith (t => {
				Console.WriteLine ("Table created!");
			});

		}
开发者ID:jeffbmiller,项目名称:ChristmasLightsFinder.IOS,代码行数:12,代码来源:HouseImageCacheRepository.cs

示例13: Button_Click_1

        private async void Button_Click_1(object sender, RoutedEventArgs e)
        {
            try
            {
                var path = ApplicationData.Current.LocalFolder.Path + @"\Users.db";
                var db = new SQLiteAsyncConnection(path);
                await db.CreateTableAsync<User>();
            }
            catch (Exception)
            { }

            //Button_Click_1.visibility = Visibility.Collapsed;
        }
开发者ID:hrishikeshgoyal,项目名称:apps_development,代码行数:13,代码来源:MainPage.xaml.cs

示例14: PrepareDatabase

		private async Task PrepareDatabase()
		{
			var path = Path.Combine(Path.GetDirectoryName(typeof(TodoService).Assembly.Location), "todos.db");

			if (File.Exists(path))
				File.Delete(path);

			var db = new SQLiteAsyncConnection(path);
			await db.CreateTableAsync<TodoItem>();

			var count = await db.InsertAllAsync(Todos);
			Assert.Equal(Todos.Count, count);
		}
开发者ID:rdacorp,项目名称:UnitTesting-Lab,代码行数:13,代码来源:US1_DB_Ingratiation.cs

示例15: createSettingsTable

 private static async void createSettingsTable()
 {
     String path = ApplicationData.Current.LocalFolder.Path + "/OCTranspo.sqlite";
     SQLiteAsyncConnection conn = new SQLiteAsyncConnection(path);
     var count = await conn.ExecuteScalarAsync<int>("SELECT COUNT(*) FROM sqlite_master WHERE type='table' AND name='OCSettings'");
     if (count == 0)
     {
         await conn.CreateTableAsync<OCSettings>();
         OCSettings settings = OCSettings.newOCSettings(500);
         settings.id = 1;
         await conn.InsertAsync(settings);
     }
 }
开发者ID:jules2689,项目名称:OCTranspoWP8,代码行数:13,代码来源:OCTranspoStopsData.cs


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