记一次纯sqlite数据库的小项目开发经历
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强多了
记一次纯sqlite数据库的小项目开发经历的更多相关文章
- EF操作sqlite数据库时的项目兼容性问题
问题:vs2015打不开vs2010建的操作sqlite的实体数据模型edmx文件 原因: 当前电脑必须先安装:驱动库及sqlite的vs拓展 正常情况下安装驱动和拓展后,vs2015就应该可以正常打 ...
- python网页爬虫小项目开发
这是我最近接的一个小项目,花了是整整四天多时间. 任务是将http://www.examcoo.com/index/detail/mid/7网站下所有的试卷里的试题全部提取出来,首先按照题型进行分类, ...
- django基础--02基于数据库的小项目
摘要:简单修改.增加部分页面,了解django开发的过程.(Python 3.9.12,django 4.0.4 ) 接前篇,通过命令: django-admin startproject myWeb ...
- 记一次处理mysql数据库无故锁表的经历
某日,生产环境上的用户表突然无故锁表,原以为只是偶发的bug.所以第一时间想到的解决方案简单粗暴:重启数据库(service mysqld restart).问题得以解决. 10min后,该表再次锁表 ...
- Qt 操作SQLite数据库
项目中通常需要采用各种数据库(如 Qracle.SQL Server.MySQL等)来实现对数据的存储.查询等功能.下面讲解如何在 Qt 中操作 SQlite 数据库. 一.SQLite 介绍 Sql ...
- android 43 SQLite数据库
SQLite数据库很小,占用内存只有几百K,安卓和IOS都是用的SQLite数据库. 页面: <LinearLayout xmlns:android="http://schemas.a ...
- Android Studio 通过一个登录功能介绍SQLite数据库的使用
前言: SQLite简介:是一款轻型的数据库,是遵守ACID的关系型数据库管理系统,它包含在一个相对小的C库中.它是D.RichardHipp建立的公有领域项目.它的设计目标是嵌入式的,而且目前已经在 ...
- [开发笔记]-sqlite数据库在使用时遇到的奇葩问题记录
有时候做些简单的项目一般都会选择sqlite数据库,优点有很多,这里就不详细说了. 在此主要记录一些平时在使用时遇到的问题及解决方法.希望能对大家有所帮助. --------------------- ...
- Object-c SQLite 数据库内存溢出问题
最近正在开发一个应用,应用里面使用SQLite 数据库的地方比较多,一些下载的内容都进行了SQLite数据库缓存,应用开发完成之后发现一个严重的问题,程序莫名其妙的崩溃,使用XCode的内存分析工具分 ...
随机推荐
- JVM 初始化阶段例子 final常量
1.创建FinalTest类,里面有一个final常量x class FinalTest{ public static final int x = 3; static { System.out.pri ...
- eclipse中导入spring-boot框架的jar包方法
如下代码引入了spring-boot的包 package openresty; import java.io.IOException; import java.security.GeneralSecu ...
- 对有序特征进行离散化(继承Spark的机器学习Estimator类)
采用信息增益或基尼指数寻找最优离散化点 package org.apache.spark.ml.feature import org.apache.spark.sql.SparkSession imp ...
- linux6 x86-64 RPM包安装mysql5.7.20
注意版本和此次更新时间 2017-12-03 版本:mysql-5.7.20-1.el6.x86_64 环境:linux6.x 官方下载地址: wget https://dev.mysql.co ...
- Laya的场景以及场景的加载
参考: Laya项目发布详解 Laya2.0 内嵌模式.加载模式.分离模式.文件模式的场景加载创建和场景打开关闭 版本2.1.1.1 白鹭中的场景是exml制作,发布后exml代码都会打包到defau ...
- 报错:MetaException(message:Version information not found in metastore. )
报错背景: CDH安装完成hive后启动失败. 报错现象: [main]: Metastore Thrift Server threw an exception... MetaException(me ...
- PAT 甲级 1146 Topological Order (25 分)(拓扑较简单,保存入度数和出度的节点即可)
1146 Topological Order (25 分) This is a problem given in the Graduate Entrance Exam in 2018: Which ...
- LeetCode_344. Reverse String
344. Reverse String Easy Write a function that reverses a string. The input string is given as an ar ...
- 打乱数组 shuffle
<?php $arr = range(,); print_r($arr); echo '<br />'; shuffle($arr); print_r($arr); ?> Ar ...
- jenkins升级完后一直显示升级中
这个时候是已经升级成功了的,刷新界面,从新登录即可