Caused by: android.database.sqlite.SQLiteException: near "where": syntax error(Sqlite code 1): , while compiling: select * from wenjian  where 1=1  and where cehao=1288,(OS error - 2:No such file or directory)
                                                                         at android.database.sqlite.SQLiteConnection.nativePrepareStatement(Native Method)
                                                                         at android.database.sqlite.SQLiteConnection.acquirePreparedStatement(SQLiteConnection.java:889)
                                                                         at android.database.sqlite.SQLiteConnection.prepare(SQLiteConnection.java:500)
                                                                         at android.database.sqlite.SQLiteSession.prepare(SQLiteSession.java:588)
                                                                         at android.database.sqlite.SQLiteProgram.<init>(SQLiteProgram.java:58)
                                                                         at android.database.sqlite.SQLiteQuery.<init>(SQLiteQuery.java:37)
                                                                         at android.database.sqlite.SQLiteDirectCursorDriver.query(SQLiteDirectCursorDriver.java:44)
                                                                         at android.database.sqlite.SQLiteDatabase.rawQueryWithFactory(SQLiteDatabase.java:1334)
                                                                         at android.database.sqlite.SQLiteDatabase.rawQuery(SQLiteDatabase.java:1268)

<1>上面是数据库语句写错了:select * from wenjian  where 1=1  and where cehao=1288

    应该只用一个where  :select * from wenjian  where 1=1  and  cehao=1288

  Caused by: android.database.sqlite.SQLiteException: unrecognized token: "01端"(Sqlite code ): , while compiling: select * from wenjian  where =  and  duanhao=01端,(OS error - :No such file or directory)
at android.database.sqlite.SQLiteConnection.nativePrepareStatement(Native Method)
at android.database.sqlite.SQLiteConnection.acquirePreparedStatement(SQLiteConnection.java:)
at android.database.sqlite.SQLiteConnection.prepare(SQLiteConnection.java:)
at android.database.sqlite.SQLiteSession.prepare(SQLiteSession.java:)
at android.database.sqlite.SQLiteProgram.<init>(SQLiteProgram.java:)
at android.database.sqlite.SQLiteQuery.<init>(SQLiteQuery.java:)
at android.database.sqlite.SQLiteDirectCursorDriver.query(SQLiteDirectCursorDriver.java:)
at android.database.sqlite.SQLiteDatabase.rawQueryWithFactory(SQLiteDatabase.java:)
at android.database.sqlite.SQLiteDatabase.rawQuery(SQLiteDatabase.java:)
Caused by: android.database.sqlite.SQLiteException: no such column: LOG(Sqlite code ): , while compiling: select * from wenjian  where =  and  gongneng=LOG,(OS error - :No such file or directory)
at android.database.sqlite.SQLiteConnection.nativePrepareStatement(Native Method)
at android.database.sqlite.SQLiteConnection.acquirePreparedStatement(SQLiteConnection.java:)
at android.database.sqlite.SQLiteConnection.prepare(SQLiteConnection.java:)
at android.database.sqlite.SQLiteSession.prepare(SQLiteSession.java:)
at android.database.sqlite.SQLiteProgram.<init>(SQLiteProgram.java:)
at android.database.sqlite.SQLiteQuery.<init>(SQLiteQuery.java:)
at android.database.sqlite.SQLiteDirectCursorDriver.query(SQLiteDirectCursorDriver.java:)
at android.database.sqlite.SQLiteDatabase.rawQueryWithFactory(SQLiteDatabase.java:)
at android.database.sqlite.SQLiteDatabase.rawQuery(SQLiteDatabase.java:)

最后解决:

select * from wenjian  where 1=1  and cehao=1288

这里的数据库表字段都是定义为vachar ,但是cehao字段里面都是存储的数字,这里在拼接sql语句时,这样写是可以运行正确的。

但是当字段存储的数据不是数字,而是字符串的话,需要加单引号(英文单引号不区分左右的),语句应该为:

select * from wenjian  where 1=1  and cehao=1288 and duanhao=‘01端’

基础语句不会啊……浪费了2个小时。

学习……

数据库SQL语句错误的更多相关文章

  1. 用PowerDesign反向生成数据库Sql语句问题

            在用Pd15反向生成数据库时,生成的Sql语句在Sql Server Manager Studio里面报错,根本就执行不了.数据库用的是Sql Server 2008 R2.经过一番修 ...

  2. 学生选课数据库SQL语句45道练习题整理及mysql常用函数(20161019)

    学生选课数据库SQL语句45道练习题: 一.            设有一数据库,包括四个表:学生表(Student).课程表(Course).成绩表(Score)以及教师信息表(Teacher).四 ...

  3. MySQL中执行sql语句错误 Error Code: 1093. You can't specify target table 'car' for update in FROM clause

    MySQL中执行sql语句错误 Error Code: 1093. You can't specify target table 'car' for update in FROM clause 201 ...

  4. MySQL 数据库SQL语句——高阶版本2

    MySQL 数据库SQL语句--高阶版本2 实验准备 数据库表配置: mysql -uroot -p show databases; create database train_ticket; use ...

  5. MySQL 数据库SQL语句——高阶版本1

    MySQL 数据库SQL语句--高阶版本 实验准备,数据表配置 mysql -uroot -p show databases; create database train_ticket; use tr ...

  6. 数据库添加数据II及SQL语句错误

    前些时候,写的代码(数据库添加数据I),往数据库添加数据都是很基本的一条一条地添加.但是平常用于测试时,总不可能一条一条地添加测试数据吧,然后我就尝试着一次性添加几百上千条,但是再次操作的时候,就出问 ...

  7. ORACLE数据库SQL语句的执行过程

    SQL语句在数据库中处理过程是怎样的呢?执行顺序呢?在回答这个问题前,我们先来回顾一下:在ORACLE数据库系统架构下,SQL语句由用户进程产生,然后传到相对应的服务端进程,之后由服务器进程执行该SQ ...

  8. 数据库 SQL语句优化

    温馨提示:本篇内容均来自网上,本人只做了稍微处理,未进行细致研究,仅当做以后不备之需,如若你喜欢可尽情转走. 一.问题的提出 在应用系统开发初期,由于开发数据库数据比较少,对于查询SQL语句,复杂视图 ...

  9. Sql Server中如何快速修正SQL 语句错误

    本文将和大家讨论一些关于找SQL 错误的问题. 现在的系统基本都是需要用到数据库的,既然用到数据库我们就要写SQL 脚本,常用的做法是现在Microsoft Sql Server Management ...

随机推荐

  1. 【技术累积】【点】【java】【4】日志级别

    闲聊 水文也是文,写总比不写好. 日志级别 虽然对其他语言的日志系统也不甚了解,但还是感觉Java的日志有些麻烦,当然也可以说是发展已久,多有变化,多有完善吧. 从日志级别来说,有从高到低的八个级别: ...

  2. 记一次IOS对 JS的支持问题

    最终在这位博主那块找到问题https://blog.csdn.net/github_36487770/article/details/82465741 在利用Vue开发一个功能时遇到时间拼接格式化问题 ...

  3. 怎么用js或jq点击展开,出现隐藏的DIV,点击收起DIV又隐藏起来.

    方法一:1 <script type="text/javascript"> $(function() { $("#toggle").click(fu ...

  4. springboot-注解讲解

    @Configuration:声明我们JdbcConfig是一个配置类 @PropertySource:指定属性文件的路径是:classpath:jdbc.properties 通过@Value为属性 ...

  5. 解决vue中模态框内数据和外面的数据绑定的问题

    1.做表格的修改,把整条数据传到模态框做修改,但是出现模态框改变数据没有保存时,表格的数据也会跟着改变,我想实现保存以后表格数据才会改变的功能. html:使用item整条数据都上传过去了,在upda ...

  6. 元素隐藏的方式之--hidden,display,visibility

    <html lang="en"> <head> <meta charset="UTF-8"> <title>标签 ...

  7. Performance Co-Pilot

    Install Performance Co-Pilot 提前安装依赖 [root@iZrj97j6t7ih9hgz1me35hZ ~]# cat install.sh yum install -y ...

  8. mysql修改时区的几种方法(转载自https://www.cnblogs.com/shiqiangqiang/p/8393662.html)

    说明: 以下记录修改mysql时区的几种方法. 具体: 方法一:通过mysql命令行模式下动态修改 1.1 查看mysql当前时间,当前时区 select curtime(); #或select no ...

  9. 计蒜客 阿里天池的新任务—简单( KMP水 )

    链接:传送门 思路:KMP模板题,直接生成 S 串,然后匹配一下 P 串在 S 串出现的次数,注意处理嵌套的情况即可,嵌套的情况即 S = "aaaaaa" ,P = " ...

  10. javaSE常用的英语单词

    1.continut 使......继续 2.break 打破 3.switch 开关:转换:鞭子 4.case 实例:情况:箱 5.Object 目标:物体 6.Class 阶级:班级:种类 7.p ...