修改数据库值 [英] modifying the database values

查看:89
本文介绍了修改数据库值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在android中做一个小程序,我能够通过注册页面将数据存储到数据库中,并且在用户登录后,我可以显示特定的详细信息.

现在我正在尝试,如果用户想要修改他的数据,他能够替换数据库中的原始值,为此,我使用了一个按钮,当用户再次按下该按钮时,注册页面必须随用户一起出现详细信息,当他修改并按下提交"按钮时,旧记录应删除,新值应以相同的ID存储在其中.我还有一个要求,那就是限制现有的用户名.为此,我使用了一种搜索方法并将值存储在游标中,现在我不知道如何将用户名与游标值进行比较.

I am doing a small program in android, I am able to store the data through the registration page into the database and after the user logged in I can display the particular details.

And now I am trying that, if user wants to modify his data, he is able to replace the original values in the database, for this I used a button, when the user pressed the button again the registration page have to come with the user details and when he modifies and presses the submit button the old record should delete and the new values shall store in with same id. and i have one more requirement, that is to restrict the existing username. For this i used a search method and store the values in cursor, and now i don''t know how to compare the username with the cursor values.

推荐答案

Are您说您不知道如何编写SQL在数据库中进行更新? 此处. [
Are you saying you don''t know how to write the SQL to do an update in the database ? Here.[^]

If that''s not it, please explain and post some code.


< a href ="http://www.codeproject.com/Articles/119293/Using-SQLite- Android上的数据库">在Android上使用SQLite数据库[/a] [< a href ="http://www.codeproject.com/Articles/119293/Using-SQLite-Database-with-Android" target = "_blank" title =新窗口"> ^</a>]

我通过此链接,在这里您可以找到一个示例代码来执行所有操作,例如添加,搜索,修改和删除....
<a href="http://www.codeproject.com/Articles/119293/Using-SQLite-Database-with-Android">Using SQLite Database with Android</a>[<a href="http://www.codeproject.com/Articles/119293/Using-SQLite-Database-with-Android" target="_blank" title="New Window">^</a>]

i gone through the this link and here u can find a sample code do all the operations like add,search,modify and delete....


这篇关于修改数据库值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆