本文整理汇总了C#中SQLite.SQLiteConnection.Query方法的典型用法代码示例。如果您正苦于以下问题:C# SQLite.SQLiteConnection.Query方法的具体用法?C# SQLite.SQLiteConnection.Query怎么用?C# SQLite.SQLiteConnection.Query使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SQLite.SQLiteConnection
的用法示例。
在下文中一共展示了SQLite.SQLiteConnection.Query方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: FindAll
public IEnumerable<Item> FindAll(int sourceId)
{
using (var db = new SQLite.SQLiteConnection(Settings.DatabasePath))
{
return db.Query<Item>("select * from Item where SourceId = ?", sourceId);
}
}
示例2: FindAllExcept
public IEnumerable<Project> FindAllExcept(int projectId)
{
using (var db = new SQLite.SQLiteConnection(Settings.DatabasePath))
{
return db.Query<Project>("select * from Project where Id <> ?", projectId);
}
}
示例3: update
public void update(string name,string address)
{
using (var db = new SQLite.SQLiteConnection(app.dbPath))
{
try
{//db.Execute("update meterbox set currentUnits = currentUnits -" + used);
var existing = db.Query<Job>("select * from Job").First();
if (existing != null)
{
existing.name = name;
existing.address = address;
db.RunInTransaction(() =>
{
db.Update(existing);
});
}
}
catch (Exception e)
{
}
}
}
示例4: FindAll
public IEnumerable<Source> FindAll(int projectId)
{
using (var db = new SQLite.SQLiteConnection(Settings.DatabasePath))
{
return db.Query<Source>("select * from Source where ProjectId = ?", projectId);
}
}
示例5: FindAll
public IEnumerable<Locale> FindAll(int projectId)
{
using (var db = new SQLite.SQLiteConnection(Settings.DatabasePath))
{
return db.Query<Locale>("select * from Locale where ProjectId = ? order by DisplayName", projectId);
}
}
示例6: getBusinessQuestions1
public ObservableCollection<SubjectViewModel> getBusinessQuestions1(string gr)
{
string no = "no";
string yes = "yes";
subject = new ObservableCollection<SubjectViewModel>();
using (var db = new SQLite.SQLiteConnection(app.dbPath))
{
//var query = db.Table<English>();
var query = db.Query<Business>("select * from Business where GRADE ='" + gr + "' and read ='" + no + "'");
foreach (var j in query)
{
var sub = new SubjectViewModel()
{
ID = j.Id,
QUESTION = j.question,
ANSWER = j.answer,
ANSWER1 = j.answer2,
ANSWER2 = j.answer3,
GRADE = j.GRADE,
READ = j.read
};
subject.Add(sub);
}
}
return subject;
}
示例7: FindAll
public IEnumerable<Preference> FindAll()
{
using (var db = new SQLite.SQLiteConnection(Settings.DatabasePath))
{
return db.Query<Preference>("select * from Preference");
}
}
示例8: Delete
public static void Delete()
{
using (Siaqodb siaqodb = new Siaqodb())
{
siaqodb.Open(siaqodbPath, 100 * OneMB, 20);
Console.WriteLine("DeleteSiaqodb...");
var all = siaqodb.LoadAll<MyEntity>();
var stopwatch = new Stopwatch();
stopwatch.Start();
foreach(MyEntity en in all)
{
siaqodb.Delete(en);
}
stopwatch.Stop();
Console.WriteLine("DeleteSiaqodb took:" + stopwatch.Elapsed);
}
using (var dbsql = new SQLite.SQLiteConnection(sqLitePath))
{
Console.WriteLine("DeleteSQLite...");
var all = dbsql.Query<MyEntity>("select * from MyEntity");
var stopwatch = new Stopwatch();
stopwatch.Start();
foreach (MyEntity en in all)
{
dbsql.Delete(en);
}
stopwatch.Stop();
Console.WriteLine("DeleteSQLite took:" + stopwatch.Elapsed);
}
}
示例9: removeUser
public User removeUser(string username)
{
using (var db = new SQLite.SQLiteConnection(app.DBPath))
{
var existingUser = db.Query<User>("delete from User where USER_EMAIL = '" + username + "'").FirstOrDefault();
return existingUser;
}
}
示例10: verify
public User verify(string username)
{
using (var db = new SQLite.SQLiteConnection(app.DBPath))
{
var existingUser = db.Query<User>("select * from User where USER_EMAIL = '" + username + "'").Single();
return existingUser;
}
}
示例11: getUser
public User getUser(string username, string password)
{
using (var db = new SQLite.SQLiteConnection(app.DBPath))
{
var existingUser = db.Query<User>("select * from User where USER_EMAIL = '" + username + "' and PASSWORD = '" + password + "'").FirstOrDefault();
return existingUser;
}
}
示例12: getData
public User getData(int value)
{
using (var db = new SQLite.SQLiteConnection(app.dbPath))
{
var query = db.Query<User>("select * from User where Id = " + value).FirstOrDefault();
return query;
}
}
示例13: getInstitution
public Institution getInstitution()
{
using (var db = new SQLite.SQLiteConnection(app.dbPath))
{
var select = db.Query<Institution>("select * from Institution").FirstOrDefault();
return select;
}
}
示例14: getOrphanages
public Orphanage getOrphanages()
{
using (var db = new SQLite.SQLiteConnection(app.dbPath))
{
var query = db.Query<Orphanage>("select * from Orphanage").FirstOrDefault();
return query;
}
}
示例15: LogIn
public Member LogIn(string email, string password)
{
using (var db = new SQLite.SQLiteConnection(app.dbPath))
{
var query = db.Query<Member>("select * from Member where email = '" + email + "' and password = '" + password + "'").FirstOrDefault();
return query;
}
}