コード例 #1
0
 // Insertview
 public void InsertView <T>(DataTable dt, string query = "") where T : RecordObject
 {
     using (var con = new SQLiteConnection("Data Source=" + DbPath.GetPath <T>()))
     {
         using (var adapter = new SQLiteDataAdapter(
                    (query.Equals("")) ? "SELECT * FROM " + TableList.GetTableName <T>() : query, con))
         {
             adapter.Fill(dt);
         }
         con.Dispose();
     }
 }
コード例 #2
0
        public int Count <T>(string where = "")
        {
            int ret;

            using (var conn = new SQLiteConnection("Data Source=" + DbPath.GetPath <T>()))
            {
                conn.Open();
                using (var command = conn.CreateCommand())
                {
                    command.CommandText = "SELECT COUNT(*) FROM " + TableList.GetTableName <T>() + " " + where;
                    ret = int.Parse(command.ExecuteScalar().ToString());
                }
                conn.Close();
            }
            return(ret);
        }
コード例 #3
0
 public List <T> SelectMulti <T>(string where = "") where T : RecordObject
 {
     return(QuerySelectImpl <T>(
                DbPath.GetPath <T>(),
                "SELECT * FROM " + TableList.GetTableName <T>() + " " + where));
 }