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


C# SQLite.SQLiteConnection类代码示例

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


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

示例1: Drop

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

示例2: BasicSetting

 //기본 카테고리 생성
 public void BasicSetting()
 {
     try
     {
         //DB와 연결
         SQLiteConnection conn = new SQLiteConnection(dbPath, true);
         //기본 카테고리들 생성
         string[] basicIncomeCategory = { "Salary", "Interest", "Installment Saving", "Allowance" };
         string[] basicExpenseCategory = { "Electronics", "Food", "Internet", "Transport", "Housing" };
         //돌아가면서 Income category insert
         foreach (string tempCategory in basicIncomeCategory)
         {
             IncomeCategoryForm basicCategory = new IncomeCategoryForm
             {
                 categoryName = tempCategory
             };
             conn.Insert(basicCategory);
         }
         //돌아가면서 expense category insert
         foreach (string tempCategory in basicExpenseCategory)
         {
             ExpenseCategoryForm expenseCategory = new ExpenseCategoryForm
             {
                 categoryName = tempCategory
             };
             conn.Insert(expenseCategory);
         }
     }
     catch (Exception ex)
     {
         ex.Message.ToString();
     }
 }
开发者ID:sviom,项目名称:MoneyNote,代码行数:34,代码来源:SQLiteMethods.cs

示例3: GetLastLocation

 private async Task<Location> GetLastLocation()
 {
     using (var db = new SQLiteConnection(Database.DatabasePath))
     {
         return db.Table<Location>().OrderByDescending(x => x.Timestamp).FirstOrDefault();
     }
 }
开发者ID:peterdn,项目名称:Geomoir,代码行数:7,代码来源:MainPage.xaml.cs

示例4: CheckAuth

		public static async Task<Exception> CheckAuth(string id, string pass,SQLiteConnection connection)
		{
			pass = base64Encode (pass);
			var httpClient = new HttpClient ();
			Exception  error;
			httpClient.Timeout = TimeSpan.FromSeconds (20);
			string contents;
			Task<string> contentsTask = httpClient.GetStringAsync ("http://www.schoolapi.somee.com/dangnhap/"+id+"/"+pass);

			try
			{
				contents =  await contentsTask;

			}
			catch(Exception e) {
				error =new Exception("Xảy Ra Lỗi Trong Quá Trình Kết Nối Server");
				return error;
			}
			if (contents.Contains ("false")) {
				error=new Exception("Mã Sinh Viên Hoặc Mật Khẩu Không Đúng");
				return error;

			}
			User usr = new User ();
			usr.Password = pass;
			usr.Id = id;
			Task<string> contentNameTask = httpClient.GetStringAsync ("http://www.schoolapi.somee.com/user/" + id);
			contents=await contentNameTask;
			XDocument doc = XDocument.Parse (contents);
			usr.Hoten= doc.Root.Elements().ElementAt(0).Elements().ElementAt(1).Value.ToString();
			int i = AddUser (connection, usr);
			return null;
		}
开发者ID:tienbui123,项目名称:Mobile-VS2,代码行数:33,代码来源:BUser.cs

示例5: Initialize

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

示例6: InsertPost

 public void InsertPost(Post post)
 {
     using(Connection = new SQLiteConnection(this.DbPath))
     {
         this.Connection.Insert(post);
     }
 }
开发者ID:CodeTrainerFormation,项目名称:WindowsPhone,代码行数:7,代码来源:PostHelper.cs

示例7: getAll

			public static List<DiemThi> getAll(SQLiteConnection connection)
			{
				list = new List<DiemThi>();
				DataProvider dtb = new DataProvider (connection);
				list = dtb.GetAllDT ();
				return list;
			}
开发者ID:tienbui123,项目名称:School-App-Mobile,代码行数:7,代码来源:BDiemThi.cs

示例8: AddCategoryOffline

        public bool AddCategoryOffline(CategoryOfflineViewModel newCategoryOffline, string _synced)
        {
            bool result = false;
            try
            {
                using (var db = new SQLite.SQLiteConnection(_dbPath))
                {
                    CategoryOffline objCategoryOffline = new CategoryOffline();

                    objCategoryOffline.categoryId = Convert.ToString(newCategoryOffline.categoryId);
                    objCategoryOffline.organizationId = Convert.ToString(newCategoryOffline.organizationId);
                    objCategoryOffline.categoryCode = Convert.ToString(newCategoryOffline.categoryCode);
                    objCategoryOffline.categoryDescription = newCategoryOffline.categoryDescription;
                    objCategoryOffline.parentCategoryId = newCategoryOffline.parentCategoryId;
                    objCategoryOffline.imageName = newCategoryOffline.imageName;
                    objCategoryOffline.active = newCategoryOffline.active;

                    objCategoryOffline.synced = _synced;  // i.e. Need to synced when online and Update the synced status = "True"

                    db.RunInTransaction(() =>
                    {
                        db.Insert(objCategoryOffline);
                    });
                }

                result = true;
            }//try
            catch (Exception ex)
            {

            }//catch
            return result;
        }
开发者ID:neetajoshi1908,项目名称:PointPay,代码行数:33,代码来源:CategoryDataProvider.cs

示例9: DoSomeDataAccess

		/// <returns>
		/// Output of test query
		/// </returns>
		public static string DoSomeDataAccess ()
		{
			var output = "";
			output += "\nCreating database, if it doesn't already exist";
			string dbPath = Path.Combine (
				Environment.GetFolderPath (Environment.SpecialFolder.Personal), "ormdemo.db3");

			var db = new SQLiteConnection (dbPath);
			db.CreateTable<Stock> ();

			if (db.Table<Stock> ().Count() == 0) {
				// only insert the data if it doesn't already exist
				var newStock = new Stock ();
				newStock.Symbol = "AAPL";
				db.Insert (newStock); 

				newStock = new Stock ();
				newStock.Symbol = "GOOG";
				db.Insert (newStock); 

				newStock = new Stock ();
				newStock.Symbol = "MSFT";
				db.Insert (newStock);
			}

			output += "\nReading data using Orm";
			var table = db.Table<Stock> ();
			foreach (var s in table) {
				output += "\n" + s.Id + " " + s.Symbol;
			}

			return output;
		}
开发者ID:ARMoir,项目名称:mobile-samples,代码行数:36,代码来源:OrmExample.cs

示例10: ProcessPath

        public static void ProcessPath(string databasePath, string filePath)
        {
            //TODO ensure directory exists for the database
            using (var db = new SQLiteConnection(databasePath)) {

                DatabaseLookups.CreateTables(db);

                var hdCollection = DriveUtilities.ProcessDriveList(db);

                var start = DateTime.Now;

                List<string> arrHeaders = DriveUtilities.GetFileAttributeList(db);

                var directory = new DirectoryInfo(filePath);

                var driveLetter = directory.FullName.Substring(0, 1);
                //TODO line it up with the size or the serial number since we will have removable drives.
                var drive = hdCollection.FirstOrDefault(letter => letter.DriveLetter.Equals(driveLetter, StringComparison.OrdinalIgnoreCase));

                if (directory.Exists) {
                    ProcessFolder(db, drive, arrHeaders, directory);
                }

                //just in case something blew up and it is not committed.
                if (db.IsInTransaction) {
                    db.Commit();
                }

                db.Close();
            }
        }
开发者ID:joefeser,项目名称:WhereAreMyFiles,代码行数:31,代码来源:FileDataStore.cs

示例11: Update

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

示例12: Initialize

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

示例13: GetAccounts

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

示例14: CreateDatabase

        /// <summary>
        /// Creates the database if it doesn't already exist.
        /// </summary>
        internal static void CreateDatabase()
        {
            try
            {
                if (!File.Exists(IndexLocation))
                {
                    string absolutePath = HostingEnvironment.MapPath(VirtualCachePath);

                    if (absolutePath != null)
                    {
                        DirectoryInfo directoryInfo = new DirectoryInfo(absolutePath);

                        if (!directoryInfo.Exists)
                        {
                            // Create the directory.
                            Directory.CreateDirectory(absolutePath);
                        }
                    }

                    using (SQLiteConnection connection = new SQLiteConnection(IndexLocation))
                    {
                        connection.CreateTable<CachedImage>();
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
开发者ID:hputtick,项目名称:ImageProcessor,代码行数:33,代码来源:SQLContext.cs

示例15: SaveLTRemind

		public static void SaveLTRemind(SQLiteConnection connection,LTRemindItem item)
		{
			DataProvider dtb = new DataProvider (connection);
			if (dtb.GetLTRemind (item.MaMH, item.NamHoc, item.HocKy) == null) {
				dtb.AddRemindLT (item);
			}
		}
开发者ID:tienbui123,项目名称:Mobile-VS2,代码行数:7,代码来源:BRemind.cs


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