Home > Database > Mysql Tutorial > 数据库Log之Couldn't read row 0, col

数据库Log之Couldn't read row 0, col

WBOY
Release: 2016-06-07 15:29:56
Original
1611 people have browsed it

今天写代码,日志报出了一个很奇葩的错误。在CursorWindow的信息是Couldn't read row 0, col -1 这个错误一般是从sqlite查数据的时候照不到指定的列,或数据类型不匹配。避免这些低级错误最好养成良好的编程习惯,比如写成“cursor.getString(cursor.getColu

今天写代码,日志报出了一个很奇葩的错误。在CursorWindow的信息是Couldn't read row 0, col -1

这个错误一般是从sqlite查数据的时候照不到指定的列,或数据类型不匹配。避免这些低级错误最好养成良好的编程习惯,比如写成“cursor.getString(cursor.getColumnIndex("xxx"))”而不是“cursor.getString(3)”。

再有的一点可能是db = dbHelper.getReadableDatabase();而实际上db = dbHelper.getWritableDatabase();

这个错误就是在构造函数db = dbHelper.getWritableDatabase();初始化后,在后面查询数据忘了改过来

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template