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


C# SQLiteConnection.DropTable方法代码示例

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


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

示例1: InserindoListaFabricantes

 public void InserindoListaFabricantes(List<Fabricante> fabricantes)
 {
     using (var dbConn = new SQLiteConnection(DB_path))
     {
         dbConn.DropTable<Fabricante>();
         dbConn.Dispose();
         dbConn.Close();
     }
     foreach (Fabricante f in fabricantes)
         this.Inserindo(f);
 }
开发者ID:marceloodir,项目名称:LojaPhoneRestSQLite,代码行数:11,代码来源:DataBaseHelperAccess.cs

示例2: KspMods

        public KspMods(string a_InstallationDirectory, string a_ModPath )
        {
            InstallationDirectory = a_InstallationDirectory;
            ModDirectory = a_ModPath;

            db = new SQLiteConnection("kmm.sqlite");

            // make sure the table exists
            if (db.GetTableInfo("KMMInfo").Count == 0)
            {
                db.CreateTable<KMMInfo>();
            }

            var tables = new Type[] { typeof(InstalledMods), typeof(ModFiles), typeof(InstalledFiles) };

            foreach (var table in tables)
            {
                var info = db.GetTableInfo(table.Name);
                if (info.Count == 0)
                    db.CreateTable(table);
            }

            // oh noez it does not match
            if (db.Table<KMMInfo>().Count() == 0 || db.Table<KMMInfo>().First().Version != GetAssemblyVersion())
            {
                // salvage data
                var installed_mods = db.Table<InstalledMods>().ToList();
                db.DropTable<InstalledMods>();
                db.CreateTable<InstalledMods>();
                db.InsertAll(installed_mods);

                var mod_files = db.Table<ModFiles>().ToList();
                db.DropTable<ModFiles>();
                db.CreateTable<ModFiles>();
                db.InsertAll(mod_files);

                var installed_files = db.Table<InstalledFiles>().ToList();
                db.DropTable<InstalledFiles>();
                db.CreateTable<InstalledFiles>();
                db.InsertAll(installed_files);
            }

            // make sure the table is filled
            if (db.Table<KMMInfo>().Count() == 0)
            {
                var nfo = new KMMInfo()
                {
                    Version = GetAssemblyVersion()
                };
                db.Insert(nfo);
            }
        }
开发者ID:jawsper,项目名称:KspModManager,代码行数:52,代码来源:KspMods.cs

示例3: Drop

 public void Drop()
 {
     using (var db = new SQLiteConnection(DbPath))
     {
         db.DropTable<TracklistItem>();
     }
 }
开发者ID:robUx4,项目名称:vlc-winrt,代码行数:7,代码来源:TracklistItemDatabase.cs

示例4: Drop

 public void Drop()
 {
     using (var connection = new SQLiteConnection(_dbPath))
     {
         connection.DropTable<Account>();
     }
 }
开发者ID:FLKone,项目名称:HFR4WinRT,代码行数:7,代码来源:AccountDataRepository.cs

示例5: Exec

 public static void Exec()
 {
     using (sql.SQLiteConnection connection = new sql.SQLiteConnection("testdb.db"))
     {
         connection.CreateTable(typeof (Table));
         connection.Insert(typeof (A));
         connection.DropTable<Table>();
     }
 }
开发者ID:pu1s,项目名称:500px.API,代码行数:9,代码来源:TokenStore.cs

示例6: SaveEvents

		public static void SaveEvents (List<Event> eventsList)
		{
			string path = Path.Combine (Environment.GetFolderPath (Environment.SpecialFolder.Personal), "Event.sqlite");

			var db = new SQLiteConnection (path);

			db.DropTable<Event> ();

			db.CreateTable<Event> ();

			db.InsertAll (eventsList);
		}
开发者ID:harryxiaxia,项目名称:ibeaconDemo,代码行数:12,代码来源:SQLiteManagement.cs

示例7: Setup

        public void Setup()
        {
            _cache.ApplicationName = AppName;

            _expectedDatabasePath = Path.Combine(
                Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData), AppName),
                "SimpleObjectCache");

            Directory.CreateDirectory(_expectedDatabasePath);
            _connection = new SQLiteConnection(Path.Combine(_expectedDatabasePath, "cache.db3"));
            _connection.DropTable<CacheElement>();

        }
开发者ID:nicolaiarocci,项目名称:SimpleObjectCache,代码行数:13,代码来源:SqliteObjectCacheTest.cs

示例8: createDatabase

        public string createDatabase()
        {
            try
            {
                string folder = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal);
                mCon = new SQLiteConnection(System.IO.Path.Combine(folder, "db.db"));
                mCon.DropTable<User>();

                {
                    mCon.CreateTable<User>();
                    return "Database created";
                }
            }
            catch (SQLiteException ex)
            {
                return ex.Message;
            }
        }
开发者ID:danielzmud1,项目名称:databseSqllite,代码行数:18,代码来源:DataBase.cs

示例9: ViewDidLoad

		public override void ViewDidLoad ()
		{
			base.ViewDidLoad ();

			// Figure out where the SQLite database will be.
			var documents = Environment.GetFolderPath(Environment.SpecialFolder.Personal);
			_pathToDatabase = Path.Combine(documents, "db_sqlite-net.db");

			using (var conn= new SQLite.SQLiteConnection(_pathToDatabase))
			{
				conn.DropTable<Terms>();
				conn.CreateTable<Terms>();
			}

			btnAceptar.TouchUpInside += (sender, e) => {
				insertTerms();
				NavigationController.PopViewController(true);
			};

			btnCancelar.TouchUpInside += (sender, e) => NavigationController.PopViewController (true);
		}
开发者ID:saedaes,项目名称:ProductFinder,代码行数:21,代码来源:TermsView.cs

示例10: ClearDatabase

		public async Task ClearDatabase ()
		{
			using (var connection = new SQLiteConnection (dbPath, true))
				await Task.Run (() => connection.DropTable<BikeTrip> ()).ConfigureAwait (false);
		}
开发者ID:nagyist,项目名称:bikr,代码行数:5,代码来源:DataApi.cs

示例11: AllTableDrop

 //테이블 전체 삭제 및 재생성
 public bool AllTableDrop()
 {
     bool result = false;
     try
     {
         //DB Connection
         SQLiteConnection conn = new SQLiteConnection(dbPath, true);
         //테이블 삭제
         conn.DropTable<DBForm.MoneyDBForm>();
         conn.DropTable<DBForm.ExpenseCategoryForm>();
         conn.DropTable<DBForm.IncomeCategoryForm>();
         //연결종료
         conn.Close();
         //새로 테이블을 만든다.
         CreateDatabaseAsync();
         //카테고리 새로 세팅
         BasicSetting();
         //어플리케이션종료하기위해 결과 값을 리턴한다.
         result = true;
     }
     catch (Exception ex)
     {
         ex.Message.ToString();
         result = false;
     }
     return result;
 }
开发者ID:sviom,项目名称:MoneyNote,代码行数:28,代码来源:SQLiteMethods.cs

示例12: DeleteAllContact

 //Delete all contactlist or delete Contacts table 
 public void DeleteAllContact()
 {
     using (var dbConn = new SQLiteConnection(App.DB_PATH))
     {
         //dbConn.RunInTransaction(() => 
         //   { 
         dbConn.DropTable<GhiChu>();
         dbConn.CreateTable<GhiChu>();
         dbConn.Dispose();
         dbConn.Close();
         //}); 
     }
 }
开发者ID:ThanhBui92,项目名称:T.note,代码行数:14,代码来源:DatabaseHelper.cs

示例13: DeleteAllContact

 }//DELETE CONTACT THAT I CHOSE
 //DELETE ALL
 public void DeleteAllContact()
 {
     using (var dbConn = new SQLiteConnection(App.DB_PATH))
     {
         dbConn.DropTable<Contactos>();
         dbConn.CreateTable<Contactos>();
         dbConn.Dispose();
         dbConn.Close();
     }
 }
开发者ID:Philipedeveloper,项目名称:Xcontact,代码行数:12,代码来源:DataBaseHelperClass.cs

示例14: Main

		public static void Main (string[] args)
		{
			Console.WriteLine ("Hello SQLite-net Data!");

			/*
			//Get the path to the folder where the database is stored.
			// Notes: The Path class performs operations on strings that contain file path info
			//        Path.Combine appends the second path to the first path
			//        Environment.GetSpecialFolderPath gets the path to special pre-defined folders
			//              on Windows, the SpecialFolder enum defines: ProgramFiles, System, AppData, etc.
			//              on Android ...
			string dbPath = Path.Combine (
				Environment.GetFolderPath (Environment.SpecialFolder.Personal), "stocks.db3");
			*/

			/*
			// Check for an existing db file and only create a new one if it doesn't exist
			bool exists = File.Exists (dbPath);
			if (!exists) {
				// Need to create the database and seed it with some data.
				SQLiteConnection.CreateFile (dbPath);
			*/

			// We're using a file in Assets instead of the one defined above
			//string dbPath = Directory.GetCurrentDirectory ();
			string dbPath = @"../../../DataAccess-Android/Assets/stocks.db3";
			var db = new SQLiteConnection (dbPath);

			// Create a Stocks table
			//if (db.CreateTable (Mono.CSharp.TypeOf(Stock)) != 0) 
				db.DropTable<Stock>();
			if (db.CreateTable<Stock>() == 0)
			{
				// A table already exixts, delete any data it contains
				db.DeleteAll<Stock> ();
			}

			// Create a new stock and insert it into the database
			var newStock = new Stock ();
			newStock.Symbol = "APPL";
			newStock.Name = "Apple";
			newStock.ClosingPrice = 93.22m;
			int numRows = db.Insert (newStock);
			Console.WriteLine ("Number of rows inserted = {0}", numRows);

			// Insert some more stocks
				db.Insert(new Stock() {Symbol = "MSFT", Name = "Microsoft", ClosingPrice = 55.25m});
				db.Insert (new Stock() {Symbol = "GOOG", Name = "Google", ClosingPrice = 15.25m});
				db.Insert (new Stock() {Symbol = "SSNLF", Name = "Samsung", ClosingPrice = 25.25m});
				db.Insert (new Stock() {Symbol = "AMZN", Name = "Amazon", ClosingPrice = 35.25m});
				db.Insert (new Stock() {Symbol = "MMI", Name = "Motorola Mobility", ClosingPrice = 45.25m});
				db.Insert (new Stock() {Symbol = "FB", Name = "Facebook", ClosingPrice = 65.25m});

			// Read the stock from the database
			// Use the Get method with a query expression
			Stock singleItem = db.Get<Stock> (x => x.Name == "Google");
			Console.WriteLine ("Stock Symbol for Google: {0}", singleItem.Symbol);

			singleItem = db.Get<Stock> (x => x.ClosingPrice >= 30.0m);
				Console.WriteLine ("First stock priced at or over 30: {0}, price: {1}",
									singleItem.Symbol, singleItem.ClosingPrice);
			

				// Use the Get method with a primary key
			singleItem = db.Get<Stock> ("FB");
			Console.WriteLine ("Stock Name for Symbol FB: {0}", singleItem.Symbol);

			// Query using  SQL
			var stocksStartingWithA = db.Query<Stock> ("SELECT * FROM Stocks WHERE Symbol LIKE ?", "A%"); 
			foreach(Stock stock in stocksStartingWithA)
				Console.WriteLine ("Stock starting with A: {0}", stock.Symbol);

			// Query using Linq
			var stocksStartingWithM = from s in db.Table<Stock> () where s.Symbol.StartsWith ("M") select s;
			foreach(Stock stock in stocksStartingWithM)
				Console.WriteLine ("Stock starting with M: {0}", stock.Symbol);


		}
开发者ID:tvangeest,项目名称:CS235AM-Demos,代码行数:79,代码来源:Program.cs

示例15: DeleteActivities

 //~~~delete all activities
 public void DeleteActivities ()
 {
     using (var dbConn = new SQLiteConnection(this.KreyosDBPath))
     {
         //dbConn.RunInTransaction(() => 
         //   { 
         dbConn.DropTable<Kreyos_User_Activities>();
         dbConn.CreateTable<Kreyos_User_Activities>();
         dbConn.Dispose();
         dbConn.Close();
         //}); 
     }
 } 
开发者ID:kreyosopensource,项目名称:KreyosWP,代码行数:14,代码来源:DatabaseManager.cs


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