I debugged a piece of code today and reported the-1 error (no corresponding row or column is found based on the row or column name ). The first thought was whether there was a problem with the corresponding database. After searching for a long time, I found that all the columns were missing and the column names were not wrong. Another thought is that the database structure changes and the application needs to be re-installed, so the re-deployment on the mobile phone still reports the same error.
I debugged a piece of code today and reported the-1 error (no corresponding row or column is found based on the row or column name ). The first thought was whether there was a problem with the corresponding database. After searching for a long time, I found that all the columns were missing and the column names were not wrong. Another thought is that the database structure changes and the application needs to be re-installed, so the re-deployment on the mobile phone still reports the same error.
I debugged a piece of code today and reported the-1 error (no corresponding row or column is found based on the row or column name ). The first thought was whether there was a problem with the corresponding database. After searching for a long time, I found that all the columns were missing and the column names were not wrong. Another thought is that the database structure changes and the application needs to be re-installed, so the re-deployment on the mobile phone still reports the same error.
Finally, I found the problem. It was a small mistake: when defining the Cursor, the second parameter of the query () function requires the corresponding column name! Cursor returns a sub-table, and all the remaining query results are processed only based on the sub-table. Therefore, even if the original database defines rows or columns, if the child table returned by Cursor does not contain them, an error is returned! After the database is added, the database returns to normal.
PS: Another tips: when the data in the database cannot be directly stored as a txt file on the SD card on the mobile phone for some reason (for example, zWatch I am developing cannot store any files at all ), you can write a function to read all the data in the database in the form of logs, and then manually save it. Never get bored.
Smaller details: "/n" in the Log file does not represent line breaks ..