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


C# SQLiteConnection.Get方法代码示例

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


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

示例1: GetTask

		public Task GetTask (int id)
		{
			using(var database = new SQLiteConnection(_helper.WritableDatabase.Path))
		    {
				return database.Get<Task>(id);
			}
		}
开发者ID:sourcefile,项目名称:OrdinaCompetitie,代码行数:7,代码来源:DatabaseManager.cs

示例2: GetTaskById

        // code to retrieve speicif record using ORM
        public string GetTaskById( int id)
        {
            string dbPath = Path.Combine(Environment.GetFolderPath
                (Environment.SpecialFolder.Personal), "ormdemo.db3");
            var db = new SQLiteConnection(dbPath);

            var item = db.Get<ToDoTasks>(id);
            return item.Task;
        }
开发者ID:Kundentelefon,项目名称:DBDEMO,代码行数:10,代码来源:DBRepository.cs

示例3: GetEventById

        //NEEDS WORK
        //This function returns an event table based on id
        public EventInfo GetEventById(int id)
        {
            string dbPath = Path.Combine (Environment.GetFolderPath (Environment.SpecialFolder.Personal), "AutomatechORM.db3");
            var db = new SQLiteConnection (dbPath);
            var table = db.Table<EventInfo> ();

            var item = db.Get<EventInfo> (id);

            return item;
        }
开发者ID:Pat-Dolan,项目名称:CMPS285_Team7,代码行数:12,代码来源:EventDB.cs

示例4: GetBeacon

 public static Beacons GetBeacon(int id)
 {
     try
     {
         var db = new SQLiteConnection(dbPath);
         return db.Get<Beacons>(id);
     }
     catch
     {
         return null;
     }
 }
开发者ID:Carbonchief,项目名称:SearchIt,代码行数:12,代码来源:Database.cs

示例5: Get

		public static string Get () 
		{
			var output = "";
			output += "\nGet query example: ";
			string dbPath = Path.Combine (
				Environment.GetFolderPath (Environment.SpecialFolder.Personal), "ormdemo.db3");
			
			var db = new SQLiteConnection (dbPath);
			
			var returned = db.Get<Stock>(2);
			
			return output;
		}
开发者ID:ARMoir,项目名称:mobile-samples,代码行数:13,代码来源:OrmExample.cs

示例6: makeavail

        public void makeavail()
        {
            Model.Userdata userd = new Model.Userdata();

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

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

            var result = db.Get<Model.Userdata>(1);

            test.Text = "Hello" + result.getName();

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

示例7: LogIn

 public bool LogIn(AccountDB account)
 {
     using (var dbConnection = new SQLiteConnection(_dbUnitAndroidPrinterApp))
     {
         try
         {
             dbConnection.Get<AccountDB>(x => x.Login == account.Login && x.Password == account.Password);
             return true;
         }
         catch(Exception)
         {
             return false;
         }
     }
 }
开发者ID:WakeDown,项目名称:UnitPrinter,代码行数:15,代码来源:UnitAPIShellAutorizator.cs

示例8: UpdateBeacon

        // Update a Beacon
        public static int UpdateBeacon(int bID, string Name, string Longitude, string Latitude, double Distance)
        {
            try
            {
                var db = new SQLiteConnection(dbPath);

                //Get Beacon to update
                var Beacon = db.Get<Beacons>(bID);

                //Assign new values to the Beacon
                Beacon.bName = Name;
                Beacon.bLatitude = Latitude;
                Beacon.bLongitude = Longitude;
                Beacon.bDistance = Distance;

                //Update Beacon
                var result = db.Update(Beacon);
                return result;
            }
            catch (Exception exc)
            {
                return -1;
            }
        }
开发者ID:Carbonchief,项目名称:SearchIt,代码行数:25,代码来源:Database.cs

示例9: RunUpdateTest

        async Task RunUpdateTest()
        {
            await Task.Factory.StartNew(() =>
            {
                using (var db = new SQLiteConnection(DatabasePath))
                {
                    db.RunInTransaction(async () =>
                    {
                        // run the update operation
                        var person = db.Get<Person>(f => f.FullName.EndsWith("8"));
                        person.OtherField = "ABCD";
                        db.Update(person);

                        // check it was persisted
                        var updatedPerson = db.Get<Person>(f => f.FullName.EndsWith("8"));
                        var message = updatedPerson.OtherField == "ABCD"
                                      ? "Completed!"
                                      : "Did not update person!";

                        await dispatcher.RunIdleAsync(a => { UpdateResult = message; });
                    });
                }
            });
        }
开发者ID:kiwipom,项目名称:billboard,代码行数:24,代码来源:SyncDatabaseViewModel.cs

示例10: updateEvent

 //NEEDS INTEGRATION
 //This function updates an existing event with new info
 public string updateEvent(int id,string name, string location, string date, string time)
 {
     string dbPath = Path.Combine (Environment.GetFolderPath (Environment.SpecialFolder.Personal), "AutomatechORM.db3");
     var db = new SQLiteConnection(dbPath);
     var item = db.Get<EventInfo>(id) ;
     item.title = name;
     item.location = location;
     item.date = date;
     item.time = time;
     db.Update (item);
     return "Record Updated...";
 }
开发者ID:Pat-Dolan,项目名称:CMPS285_Team7,代码行数:14,代码来源:EventDB.cs

示例11: settingTags

        //-----------sets the tag in the user.cs for further utilization in the application---------//
        protected void settingTags()
        {
            using (var connection = new SQLiteConnection (dbPath)) {

                var rowCount = connection.Table<User> ().Count ();

                var presentUser = connection.Get<User> (1);

                Log.Info (Tag, "rowCount: " + rowCount.ToString ());

                if (rowCount > 2) {
                    Log.Info (Tag, "Database cleared");
                    for (int i = rowCount; i > 0-1; i--) {
                        var del = connection.Delete<User> (i);
                        //var deleted = connection.Query<User> ("DELETE FROM User WHERE ID = ?", i);
                        Log.Info (Tag, "for loop i: " + i.ToString ());
                        Log.Info (Tag, "Rows deleted: " + del.ToString ());
                    }
                }

                rowCount = connection.Table<User> ().Count ();

                if (rowCount <= 2) {
                    presentUser.VacationTarget = vacationTarget;
                    connection.Update (presentUser);
                    //var Users = connection.Query<User>("UPDATE User SET Persons = ? WHERE ID = 1", persons);
                    Log.Info (Tag, "User Data Updated");
                }

            }
        }
开发者ID:rhialy,项目名称:IMD3Amsterdam,代码行数:32,代码来源:NewJourneySpecificPreference.cs

示例12: settingTags

        //-----------sets the tag in the user.cs for further utilization in the application---------//
        protected void settingTags()
        {
            using (var connection = new SQLiteConnection (dbPath)) {

                var rowCount = connection.Table<User> ().Count ();

                var presentUser = connection.Get<User> (1);

                if (rowCount <= 2) {
                    //presentUser.Persons = persons;
                    connection.Update (presentUser);
                    //var Users = connection.Query<User>("UPDATE User SET Persons = ? WHERE ID = 1", persons);
                    Log.Info (Tag, "User Data Updated");
                }
            }
        }
开发者ID:rhialy,项目名称:IMD3Amsterdam,代码行数:17,代码来源:MainPreferencesPhaseTwo.cs

示例13: updatePositionSuppliv

		public string updatePositionSuppliv (string numCommande)
		{
			string dbPath = System.IO.Path.Combine(Environment.GetFolderPath
				(Environment.SpecialFolder.Personal), "ormDMS.db3");
			var db = new SQLiteConnection(dbPath);
			string output = "";
			var query = db.Table<TablePositions>().Where (v => v.numCommande.Equals(numCommande));
			foreach (var item in query) {
				output = "YALO";
				var row = db.Get<TablePositions> (item.Id);
				row.imgpath = "SUPPLIV";
				db.Update(row);
				Console.WriteLine ("UPDATE SUPPLIV" + row.numCommande);
			}
			return output;
		}
开发者ID:Dealtis,项目名称:oldDMS_3,代码行数:16,代码来源:DBRepository.cs

示例14: logout

		public string logout()
		{		
			string dbPath = System.IO.Path.Combine(Environment.GetFolderPath
				(Environment.SpecialFolder.Personal), "ormDMS.db3");
			var db = new SQLiteConnection(dbPath);
			string output = string.Empty;
			var query = db.Table<TableUser>().Where (v => v.user_IsLogin.Equals(true));
			foreach (var item in query) {
				var row = db.Get<TableUser>(item.Id);
				row.user_IsLogin = false;
				db.Update(row);
				output = "UPDATE USER LOGOUT " + row.user_AndsoftUser;
			}
			return output;

		}
开发者ID:Dealtis,项目名称:oldDMS_3,代码行数:16,代码来源:DBRepository.cs

示例15: updatePosition

		public string updatePosition (int idposition,string statut, string txtAnomalie, string txtRemarque, string codeAnomalie, string imgpath)
		{
			string dbPath = System.IO.Path.Combine(Environment.GetFolderPath
				(Environment.SpecialFolder.Personal), "ormDMS.db3");
			var db = new SQLiteConnection(dbPath);
			string output = "";
			var row = db.Get<TablePositions>(idposition);
			row.StatutLivraison = statut;
			db.Update(row);
			output = "UPDATE POSITIONS " + row.Id;
			return output;
		}
开发者ID:Dealtis,项目名称:oldDMS_3,代码行数:12,代码来源:DBRepository.cs


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