关于Android中内容操作数据库失败的原因及修改方法
最近学习Android开发,在Android Studio编写SQL语句。 很熟悉的一点是,在Android Studio中写SQL语句的增删改查都是写在引号( )中的,因此在单词拼写错误的情况下,软件不会提示有错误,最近总结出了几点学习方法。 1.从Android Studio中导出所创建的数据
最近学习Android开发,在Android Studio编写SQL语句。
很熟悉的一点是,在Android Studio中写SQL语句的增删改查都是写在引号(" ")中的,因此在单词拼写错误的情况下,软件不会提示有错误,最近总结出了几点学习方法。
1.从Android Studio中导出所创建的数据库
在File Explorer下选择data文件夹,单击一下,在点击第二个data,在第二个data中寻找你所创建的文件夹
选择database文件下你所创建的数据库,然后导出到你的桌面或者别的地方
然后用MySql或者SQLite等可视化界面打开(DOS命令打开也可以),在这里我用MySql演示
contacts就是我所创建的数据库,内含两张表
将你代码中的SQL语句复制到该编辑区域,进行运行,检验是否有错误
(下图为错误提示,不同的错误会有不同的提示)
(下图为正确提示,正确提示会显示时间为多少秒)
SQL语句写的时候的注意事项:
1.注意你所写的内容在表格属性中是否存在;
2.在代码中注意问号的问号?
例如:
注意一下上面的两行代码,第一行是英文状态下的问号,第二行是中文状态下的问号,一定要重视这个问题,有时候语法全对,代码全对,但是程序无法按照指定的设置执行,可能就与这小小的问号有关。
语句中是不允许出现中文的?,而且中文的问号是无法被识别和操作的,既然无法识别和操作,这句语法是无法操作数据库的

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics











In recent days, Ice Universe has been steadily revealing details about the Galaxy S25 Ultra, which is widely believed to be Samsung's next flagship smartphone. Among other things, the leaker claimed that Samsung only plans to bring one camera upgrade

Samsung has not offered any hints yet about when it will update its Fan Edition (FE) smartphone series. As it stands, the Galaxy S23 FE remains the company's most recent edition, having been presented at the start of October 2023. However, plenty of

The Redmi Note 14 Pro Plus is now official as a direct successor to last year'sRedmi Note 13 Pro Plus(curr. $375 on Amazon). As expected, the Redmi Note 14 Pro Plus heads up the Redmi Note 14 series alongside theRedmi Note 14and Redmi Note 14 Pro. Li

Historically, Oppo has refreshed its flagship 'Find X' series in late winter or early spring, save for the original Find X that it announced in June 2018. To that end, the Find X7 and Find X7 Ultra are barely more than six months old at this point. H

MySQL is an open source relational database management system. 1) Create database and tables: Use the CREATEDATABASE and CREATETABLE commands. 2) Basic operations: INSERT, UPDATE, DELETE and SELECT. 3) Advanced operations: JOIN, subquery and transaction processing. 4) Debugging skills: Check syntax, data type and permissions. 5) Optimization suggestions: Use indexes, avoid SELECT* and use transactions.

Xiaomi has just announced the release date for its next Redmi Note smartphones. As expected, these are set to arrive as three Redmi Note 14 series handsets. More specifically, the company intends to release the Redmi Note 14, Redmi Note 14 Pro and Re

Lenovo is gearing up to launch the 2024 Legion Y700 on September 29 in China. This new Android gaming tablet will be going against the RedMagic Nova, and the company has already confirmed almost all the specs of the device. Now, hours before the full

TheZ9 Turbo+has now been unleashed on Vivo's online Chinese store at 2,199 yuan (~$313) for a 12GB RAM/256GB internal storage base model, whereas theRedmiK70 Extreme Editionstarted at 2,599 yuan (~$370) with the same configuration: in fact, its newiQ
