Recently studied Android development, writing SQL statements in Android Studio.
It is very familiar that, in the Android studio to write SQL statements and additions and deletions are written in quotation marks (""), so in the case of misspelled words, the software will not be prompted with errors, recently summed up a few learning methods.
1. Export the created database from Android Studio
Select the Data folder under File Explorer, click on the second data and find the folder you created in the second data
Select the database file you created and export it to your desktop or anywhere else.
Then use a visual interface such as MySQL or SQLite to open (DOS command open also can), here I use MySQL Demo
Contacts is the database I created, containing two tables
Copy the SQL statement from your code into the editing area, run it, check for errors
(for error, different errors will have different hints)
(the correct prompt will show how many seconds the time is)
What to note when SQL statements are written:
1. Notice whether the content you have written is present in the table properties;
2. Notice the question mark in the code?
For example:
Note the above two lines of code, the first line is the English state of the question mark, the second line is the Chinese state of the question mark, must pay attention to this problem, sometimes the syntax is all right, the code is all right, but the program can not be executed according to the specified settings, may be related to this small question mark.
Is the language not allowed in the statement? , and the Chinese question mark is not recognized and manipulated, since it is not recognized and manipulated, this syntax is unable to manipulate the database
About the reasons for the failure of content manipulation database in Android and how to modify it