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


C# SQLiteConnection.CreateTable方法代码示例

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


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

示例1: Proceed_Click

        private void Proceed_Click(object sender, RoutedEventArgs e)
        {
            Model.Userdata userData = new Model.Userdata();

            userData.addData(name.Text, (int)AgeList.SelectedItem, 0);

            // Create a Database.

            // Add to database.

            try
            {
                var path = Path.Combine(Windows.Storage.ApplicationData.Current.LocalFolder.Path, "App.db");

                var db = new SQLiteConnection(new SQLite.Net.Platform.WinRT.SQLitePlatformWinRT() ,path);

                db.CreateTable<Model.Userdata>();
                db.CreateTable<Model.Subject>();

                db.Insert(userData);

                this.Frame.Navigate(typeof(World2));

            }
            catch (Exception)
            {
                throw;
            }
            

            // redirecting to 

        }
开发者ID:dastanforever,项目名称:AttendanceTrackerWin10,代码行数:33,代码来源:ManageUserData.xaml.cs

示例2: ECOdatabase

		public ECOdatabase ()
		{
			database = DependencyService.Get<ISqlite> ().GetConnection ();
//			database.DeleteAll<CartItem> ();
			//Create a CartItem table if there is no such table
			if (database.TableMappings.All(t => t.MappedType.Name != typeof(CartItem).Name)) {
				//Create cartitem table
				database.CreateTable<CartItem> ();
				database.Commit ();
			}

			if (database.TableMappings.All(t => t.MappedType.Name != typeof(BuyList).Name)) {
				//Create cartitem table
				database.CreateTable<BuyList> ();
				database.Commit ();
			}

			if (database.TableMappings.All(t => t.MappedType.Name != typeof(WoolworthsItem).Name)) {
				//Create cartitem table
				database.CreateTable<WoolworthsItem> ();
				database.Commit ();
			}

//			database.DeleteAll<BuyList>();

			if (GetWoolWorthsItemAll ().Count == 0) {
				WoolworthsItem item1 = new WoolworthsItem ("50375264", "Kleenex Tissues", 2.50);
				InsertItemToWoolWorthsItem (item1);
			}

		}
开发者ID:joagwa,项目名称:EasyTechy,代码行数:31,代码来源:ECOdatabase.cs

示例3: UserService

        public UserService(ISlackRestClient restClient, ISQLite sqlite)
        {
            _restClient = restClient;
            _database = sqlite.GetConnection();

            _database.CreateTable<User>();
            _database.CreateTable<UserProfile>();
        }
开发者ID:mybifrost,项目名称:bifrost.slack,代码行数:8,代码来源:UserService.cs

示例4: FlashCardManager

        public FlashCardManager(ISQLiteConnection connection, IMvxMessenger messenger)
        {
            _messenger = messenger;

            _connection = connection.connection;
            _connection.CreateTable<FlashCardSet>();
            _connection.CreateTable<FlashCard>();
        }
开发者ID:j-hayes,项目名称:Flash-Card-App,代码行数:8,代码来源:FlashCardManager.cs

示例5: ImageRepository

 public ImageRepository()
 {
     connection = new SQLiteDroid();
     _db = connection.GetConnection();//データベース接続
     _db.CreateTable<TagItem>();//テーブル作成
     _db.CreateTable<ImageTag>();//テーブル作成
     _db.CreateTable<ImageItem>();//テーブル作成
 }
开发者ID:yasu0796,项目名称:XamarinCloudVisionApp,代码行数:8,代码来源:ImageRepository.cs

示例6: EvolveDatabase

		/// <summary>
		/// Initializes a new instance of the <see cref="Tasky.DL.TaskDatabase"/> TaskDatabase. 
		/// if the database doesn't exist, it will create the database and all the tables.
		/// </summary>
		/// <param name='path'>
		/// Path.
		/// </param>
		public EvolveDatabase(SQLiteConnection conn)
		{
			database = conn;
			// create the tables
			database.CreateTable<Speaker>();
			database.CreateTable<Session>();
			database.CreateTable<SessionSpeaker>();
			database.CreateTable<Favorite>();
		}
开发者ID:JeffHarms,项目名称:xamarin-forms-samples-1,代码行数:16,代码来源:EvolveDatabase.cs

示例7: Sqlite

 public Sqlite()
 {
     path = Path.Combine(Windows.Storage.ApplicationData.Current.LocalFolder.Path, "TripPlanner.sqlite");
     conn = new SQLiteConnection(new SQLite.Net.Platform.WinRT.SQLitePlatformWinRT(), path);
     conn.CreateTable<Plans>();
     conn.CreateTable<TripPlanner.Classes.DayEvents>();
     conn.CreateTable<Days>();
     Debug.WriteLine(path);
 }
开发者ID:nhansky,项目名称:TripPlanner,代码行数:9,代码来源:Sqlite.cs

示例8: CreateDb

 private static void CreateDb()
 {
     using (SQLiteConnection conn = new SQLiteConnection(new SQLite.Net.Platform.WinRT.SQLitePlatformWinRT(), DbPath))
     {
         conn.CreateTable<RepZoneSetting>();
         conn.CreateTable<Address>();
         conn.CreateTable<Brand>();
         conn.CreateTable<Contact>();
     }
 }
开发者ID:dengere,项目名称:App2,代码行数:10,代码来源:DbBootStrap.cs

示例9: CreateTables

 private void CreateTables()
 {
     using (var conn = new SQLiteConnection(_platform, _dbPath))
     {
         conn.CreateTable<Image>();
         conn.CreateTable<Position>();
         conn.CreateTable<Station>();
         conn.CreateTable<FavoriteTrainPath>();
         conn.Close();
     }
 }
开发者ID:DrNorton,项目名称:TrineTimeTable,代码行数:11,代码来源:SqliteContext.cs

示例10: Invoke

        public void Invoke(ServerMessage message, IIrcClient ircClient, ILogger logger)
        {
            if (message.Command.Equals("376") && !_isInitialized) //We use this to initialize the plugin. This should only happen once.
            {
                _ircClient = ircClient;
                _logger = logger;

                //Subscribe to when the stream startes/ends events
                _ircClient.TwitchService.OnStreamOnline += TwitchService_OnStreamOnline;
                _ircClient.TwitchService.OnStreamOffline += TwitchService_OnStreamOffline;

                _timer.AutoReset = true;
                _timer.Interval = 60000;
                _timer.Elapsed += _timer_Elapsed;
                _timer.Enabled = true;

                _dataFolder = PluginHelper.GetPluginDataFolder(this);

                _database = new SQLiteConnection(new SQLitePlatformWin32(), Path.Combine(_dataFolder, "CurrencyPlugin.db"));
                _database.CreateTable<CurrencyUserModel>();

                //This is for debugging
                //_watchedChannelsList.Add("#unseriouspid");
                //_onlineChannelsList.Add("#unseriouspid");

                _logger.Write($"{GetType().Name} Initialized.");
                _isInitialized = true;
            }
            else if (message.Command.Equals("PRIVMSG") &&
                        _isInitialized &&
                        _watchedChannelsList.Contains(message.GetChannelName()))
            {
                var userCommand = message.Trailing.Split(' ')[0].ToLower().TrimStart();
                var nickName = message.GetSender();
                var channelName = message.GetChannelName();

                switch (userCommand)
                {
                    case "!points":
                        if (IsUserCommandOnCooldown(userCommand, nickName, channelName)) return;
                        DisplayPoints(nickName, channelName);
                        CooldownUserCommand(userCommand, nickName, channelName);
                        break;

                    case "!gamble":
                        if (IsUserCommandOnCooldown(userCommand, nickName, channelName)) return;
                        DoGamble(message);
                        CooldownUserCommand(userCommand, nickName, channelName);
                        break;

                    case "!bonus":
                        DoAddBonus(message);
                        break;

                    case "!bonusall":
                        DoAddBonusAll(message);
                        break;
                }
            }
        }
开发者ID:xxJohnxx,项目名称:DotDotBot,代码行数:60,代码来源:CurrencyPlugin.cs

示例11: GetDatabse

 private static SQLiteConnection GetDatabse()
 {
     var connection = new SQLiteConnection(new SQLitePlatformWinRT(), DbPath);
        // 创建 Person 模型对应的表,如果已存在,则忽略该操作。
        connection.CreateTable<PostDetail>();
        return connection;
 }
开发者ID:startewho,项目名称:SLWeek,代码行数:7,代码来源:BookmarkDatabase.cs

示例12: GetDbxsqConnection

        public static SQLiteConnection GetDbxsqConnection()
        {
            var conn = new SQLiteConnection(new SQLitePlatformWinRT(), DBPath);
            conn.CreateTable<XYXS>();

            return conn;
        }
开发者ID:RedrockMobile,项目名称:CyxbsMobile_Win,代码行数:7,代码来源:getDB.cs

示例13: LocalDataService

        public LocalDataService(IDbConnectionService dbConnectionService)
        {
            this.dbConnectionService = dbConnectionService;

            connection = dbConnectionService.Connection;
            connection.CreateTable<Person>();  
        }
开发者ID:moerkc,项目名称:CongresoVisible,代码行数:7,代码来源:LocalDataService.cs

示例14: ByteArrayWhere

        public void ByteArrayWhere()
        {
            //Byte Arrays for comparisson
            ByteArrayClass[] byteArrays = new ByteArrayClass[] {
                new ByteArrayClass() { bytes = new byte[] { 1, 2, 3, 4, 250, 252, 253, 254, 255 } }, //Range check
                new ByteArrayClass() { bytes = new byte[] { 0 } }, //null bytes need to be handled correctly
                new ByteArrayClass() { bytes = new byte[] { 0, 0 } },
                new ByteArrayClass() { bytes = new byte[] { 0, 1, 0 } },
                new ByteArrayClass() { bytes = new byte[] { 1, 0, 1 } },
                new ByteArrayClass() { bytes = new byte[] { } }, //Empty byte array should stay empty (and not become null)
                new ByteArrayClass() { bytes = null } //Null should be supported
            };

            SQLiteConnection database = new SQLiteConnection(TestPath.GetTempFileName());
            database.CreateTable<ByteArrayClass>();

            byte[] criterion = new byte[] { 1, 0, 1 };

            //Insert all of the ByteArrayClass
            int id = 0;
            foreach (ByteArrayClass b in byteArrays)
            {
                database.Insert(b);
                if (b.bytes != null && criterion.SequenceEqual<byte>(b.bytes))
                    id = b.ID;
            }
            Assert.AreNotEqual(0, id, "An ID wasn't set");

            //Get it back out
            ByteArrayClass fetchedByteArray = database.Table<ByteArrayClass>().Where(x => x.bytes == criterion).First();
            Assert.IsNotNull(fetchedByteArray);
            //Check they are the same
            Assert.AreEqual(id, fetchedByteArray.ID);
        }
开发者ID:Banane9,项目名称:sqlite-net,代码行数:34,代码来源:ByteArrayTest.cs

示例15: CreateTableConnection

 private static SQLiteConnection CreateTableConnection()
 {
     // 创建 News 模型对应的表,如果已存在,则忽略该操作。
     var connection = new SQLiteConnection(new SQLitePlatformWinRT(), DataBase.DbPath);
     connection.CreateTable<News>();
     return connection;
 }
开发者ID:startewho,项目名称:CnBetaUWA,代码行数:7,代码来源:NewsDataTable.cs


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