sqlite有哪些坑
1.支持的数据量级:根据SQLite的官方提示:http://www.sqlite.org/limits.html
SQLIte数据库最大支持128TiB(140 terabytes, or 128 tebibytes, or 140,000 gigabytes or 128,000 gibibytes).
2.sqlite支持T-Sql,不得不说 T-Sql是个很强大的东西,到哪都能用
3.如何访问sqlite
引入System.Data.SQLite.dll
使用 DbProviderFactories实例化
webconfig配置:
<connectionStrings>
<add name="sqlite" connectionString="Data Source=|DataDirectory|inventoryDb.db;Pooling=true;FailIfMissing=false" providerName="System.Data.SQLite" />
</connectionStrings>
<system.data>
<DbProviderFactories>
<add name="SQLiteFactory" invariant="SQLiteFactory" description="xxxxxxx" type="System.Data.SQLite.SQLiteFactory,System.Data.SQLite" />
</DbProviderFactories>
</system.data>
private static object _locker = new object();//锁对象 private static DbProviderFactory _factory;//抽象数据工厂 private static string _connectionstring;//关系数据库连接字符串 /// <summary> /// 关系数据库连接字符串 /// </summary> public static string ConnectionString { get { return _connectionstring; } } static DBHelperSqlite() { _factory = DbProviderFactories.GetFactory("SQLiteFactory"); string dbName = ConfigurationManager.AppSettings["sqliteDbName"]; _connectionstring = string.Format(ConfigurationManager.ConnectionStrings["sqlite"].ToString(),dbName); }
4.t-sql语法问题
topN :select {1} from {4} where {2} Order By {3} limit {0}
分页: select {0} from {5} where {2} order by {1} limit {4} offset {3}
使用起来很方便,比Access强多了