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


C# SQLite.SQLiteConnection.Query方法代码示例

本文整理汇总了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);
     }
 }
开发者ID:ktei,项目名称:JsonResxEditor,代码行数:7,代码来源:ItemService.cs

示例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);
     }
 }
开发者ID:ktei,项目名称:JsonResxEditor,代码行数:7,代码来源:ProjectService.cs

示例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)
                {

                }
            }
        }
开发者ID:Ranzu,项目名称:Voluteers-App,代码行数:25,代码来源:JobViewModel.cs

示例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);
     }
 }
开发者ID:ktei,项目名称:JsonResxEditor,代码行数:7,代码来源:SourceService.cs

示例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);
     }
 }
开发者ID:ktei,项目名称:JsonResxEditor,代码行数:7,代码来源:LocaleService.cs

示例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;
 }
开发者ID:sovenga,项目名称:StudyApp,代码行数:26,代码来源:SubjectsViewModel.cs

示例7: FindAll

 public IEnumerable<Preference> FindAll()
 {
     using (var db = new SQLite.SQLiteConnection(Settings.DatabasePath))
     {
         return db.Query<Preference>("select * from Preference");
     }
 }
开发者ID:ktei,项目名称:JsonResxEditor,代码行数:7,代码来源:PreferenceService.cs

示例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);
            }
        }
开发者ID:Dotissi,项目名称:SiaqodbBenchmark,代码行数:34,代码来源:Program.cs

示例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;
     }
 }
开发者ID:sovenga,项目名称:ElectricityApp,代码行数:8,代码来源:UserViewModel.cs

示例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;
     }
 }
开发者ID:sovenga,项目名称:ElectricityApp,代码行数:8,代码来源:UserViewModel.cs

示例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;
     }
 }
开发者ID:sovenga,项目名称:ElectricityApp,代码行数:8,代码来源:UserViewModel.cs

示例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;
     }
 }
开发者ID:butiBisho,项目名称:LottoAppProjectV2,代码行数:8,代码来源:Lotto.cs

示例13: getInstitution

 public Institution getInstitution()
 {
     using (var db = new SQLite.SQLiteConnection(app.dbPath))
     {
         var select = db.Query<Institution>("select * from Institution").FirstOrDefault();
         return select;
     }
 }
开发者ID:RefMashao,项目名称:InformationalApp,代码行数:8,代码来源:InstitutionViewModel.cs

示例14: getOrphanages

 public Orphanage getOrphanages()
 {
     using (var db = new SQLite.SQLiteConnection(app.dbPath))
     {
         var query = db.Query<Orphanage>("select * from Orphanage").FirstOrDefault();
         return query;
     }
 }
开发者ID:Ranzu,项目名称:Voluteers,代码行数:8,代码来源:OrphanageViewModel.cs

示例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;
     }
 }
开发者ID:butiBisho,项目名称:RecipeGeneratorApp,代码行数:8,代码来源:Insert.cs


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