本文整理汇总了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);
}
}
示例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;
}
示例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;
}
示例4: GetBeacon
public static Beacons GetBeacon(int id)
{
try
{
var db = new SQLiteConnection(dbPath);
return db.Get<Beacons>(id);
}
catch
{
return null;
}
}
示例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;
}
示例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();
}
示例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;
}
}
}
示例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;
}
}
示例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; });
});
}
});
}
示例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...";
}
示例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");
}
}
}
示例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");
}
}
}
示例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;
}
示例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;
}
示例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;
}