台账建立和sqlite数据库的数据导入和导入问题
principle
platform command starts with ".";
whiel sql command doesn't starts with ".", but ends with ";"
===============================================
错误现象:
=============================================
.import device_test.txt device;
Error: no such table: device;
sqlite>
原因 device后面不该有分号;
解决:命令改为 .import device_test.txt device
注意,以“.”开头
================================
sqlite> .import test.txt device
test.txt:1: expected 5 columns but found 1 - filling the rest with NULL
test.txt:2: expected 5 columns but found 1 - filling the rest with NULL
test.txt:3: expected 5 columns but found 1 - filling the rest with NULL
cause: 没有设置seperator ","
solution: input : .separator ","
===================================
常用命令
delete from TableName; //清空数据
update sqlite_sequence SET seq = 0 where name ='TableName';//自增长ID为0
select count(*) from device;

cd D:\sqlite_files\sqlite-tools-win32-x86-3230100
运行 sqlite3 device.db
出现sqlite>
退出命令 .quit
D:\sqlite_files\sqlite-tools-win32-x86-3230100>sqlite3.exe device.db
SQLite version 3.23.1 2018-04-10 17:39:29
Enter ".help" for usage hints.
sqlite> .tables ++++++++++++显示所有表格的表名
device
sqlite>
查看表结构
sqlite> .schema
CREATE TABLE device
(
id text,
device_no text,
device_name text,
owner text,
register_date text
);
sqlite>
sql3> select * from device;
我自己总结的sqlite 的命令行命令
导入文本数据文件时,设置分隔符为","
sql>.separator ","
sql>.import devices_20181206.txt device
注意import 前面有一个".",而且不要以;结尾
txt文件必须另存为utf8格式
sqlite数据库安装在d:\sqlite_files
运行sqlite3
查看数据表,命令,.tables
数据库文件 d:\sqlite_files\device.db
create table device
(
id text,
device_no text,
device_name text,
owner text,
register_date text
)
建立目录D:\android_projects\qrscan\app\src\main\assets
把数据库文件d:\sqlite_files\device.db 拷贝到 D:\android_projects\qrscan\app\src\main\assets
然后在as中,即android studio中出现该文件图标,右键点击,选择sql文件即可
++++++++++++++++++++++++++++++++++++++++++
问题
导入数据,import
出现提示
device_20181214.txt:683: expected 5 columns but found 1 - filling the rest with
NULL
device_20181214.txt:684: expected 5 columns but found 1 - filling the rest with
NULL
device_20181214.txt:685: expected 5 columns but found 1 - filling the rest with
NULL
device_20181214.txt:686: expected 5 columns but found 1 - filling the rest with
NULL
解决,不理它。
台账建立和sqlite数据库的数据导入和导入问题的更多相关文章
- 使用嵌入式关系型SQLite数据库存储数据
除了可以使用文件或SharedPreferences存储数据,还可以选择使用SQLite数据库存储数据. 在Android平台上,集成了一个嵌入式关系型数据库—SQLite, 1.SQLite3支持 ...
- Android中数据存储(三)——SQLite数据库存储数据
当一个应用程序在Android中安装后,我们在使用应用的过程中会产生很多的数据,应用都有自己的数据,那么我们应该如何存储数据呢? 数据存储方式 Android 的数据存储有5种方式: 1. Share ...
- 使用Sqlite数据库存储数据
1.Sql基本命令 1.1.创建表 表是有行和列组成的,列称为字段,行称为记录. 使用CREATE命令来创建表: 1 CREATE TABLE tab_student (studentId INTEG ...
- QT 创建本地数据库(SQLite数据库)存储数据
注意:QT自带SQLITE数据库,不需要再安装 1.创建一个包含创建.查询.修改和删除数据库的数据库类(DataBase) DataBase.h头文件 #pragma once #include &l ...
- Android平台使用SQLite数据库存储数据
创建一个DataBaseHelper的类,这个类是继承SQLiteOpenHelper类的,这个类中包含创建数据库.打开数据库.创建表.添加数据和查询数据的方法.代码如下: package com.e ...
- Oracle数据库采用数据泵方式导入导出数据
特别说明:Oralce的数据泵导入导出技术只能用在数据库服务器上,在只有客户端的机器上是无法使用数据泵技术的. 1.创建备份文件目录 mkdir d:\dmp 2.在Oralce中注册该目录,将目录 ...
- Android下用Sqlite数据库存储数据
第一步: 写个类 ,继承 SQLiteOpenHelper public class MyDatabaseOpenHelper extends SQLiteOpenHelper { } 第二步: ...
- Sqlite数据库添加数据以及查询数据方法
只是两个添加查询方法而已,怕时间长不用忘了
- mongodb远程数据库的连接以及备份导入导出数据
环境win10; 运行cmd cd到目录mongodb的bin目录: 连接远程mongodb: 连接命令:mongo -u username -p pwd host:post/database(数据库 ...
随机推荐
- 利用xampp集成环境搭建pikachu靶场及部分问题解决
xampp的环境部署 1.本地服务器的搭建 首先要到官网下载xampp https://www.apachefriends.org/zh_cn/index.html 有各个不同的系统版本,这里我们选择 ...
- ceph集成openstack cinder
本环境ceph已经搭建,ceph搭建麻烦见本博客的其他文章 1 在cinder-volume节点安装ceph client yum install -y ceph-common 注意:glance要安 ...
- vue全家桶(2.2)
3.3.router-link配置 3.3.1.实例 需求:实现下面效果,点击不同的菜单,显示不同的文字 核心代码:App组件 <template> <div id="ap ...
- 在eclipse中使用maven构建spring cloud微服务
使用eclipse中使用maven构建spring cloud微服务,springcloud通过maven构建项目.springcloud项目搭建. 工具/原料 eclipse maven spr ...
- C# 特性篇 Attributes
特性[Required] (必修的) /// <summary> /// 操作人EmpID /// </summary> [Required] public string Op ...
- typeof、instanceof与constructor
typeof返回一个表达式的数据类型的字符串,返回结果为js基本的数据类型,包括number,boolean,string,object,undefined,function. 语法: typeof( ...
- Java基础Day08(多线程)
多线程 1. 线程 1.1 什么是线程: 程序中负责执行的哪个东东就叫做线程(执行路线,进程内部的执行序列或者说是进程的子任务) 多线程执行时,在栈内存中,每一个执行线程都有自己所属的栈内存空间.进行 ...
- 如何在Mac中配置Python虚拟环境,踩了好多坑
如何在Mac中配置Python虚拟环境 1.安装virtualenv pip3 install virtualenv 2.安装virtualenvwrapper pip3 install virtua ...
- SpringBoot2.x入门:引入web模块
前提 这篇文章是<SpringBoot2.x入门>专辑的第3篇文章,使用的SpringBoot版本为2.3.1.RELEASE,JDK版本为1.8. 主要介绍SpringBoot的web模 ...
- ShuffleNetV1/V2简述 | 轻量级网络
ShuffleNet系列是轻量级网络中很重要的一个系列,ShuffleNetV1提出了channel shuffle操作,使得网络可以尽情地使用分组卷积来加速,而ShuffleNetV2则推倒V1的大 ...