SQLite in Android How to update a specific row

0 votes

For a time now, I've been attempting to update a certain row, and it appears that there are two ways to achieve this. According to what I've read and experienced, you can just use the:

execSQL(String sql) method

Or the:

update(String table, ContentValues values, String whereClause, String[] whereArgs) method.

Actual code.

myDB.update(TableName, "(Field1, Field2, Field3)" + " VALUES ('Bob', 19, 'Male')", "where _id = 1", null);

This is what I'm attempting to do:

In fields where the main key (_id) equals 1, update fields 1, 2, and 3.

Eclipse highlights the word "update" with a red line and provides the following just below it:

The method update(String, ContentValues, String, String[]) in the type SQLiteDatabase is not applicable for the arguments (String, String, String, null)

I suspect that I'm not accurately assigning the ContentValues. Can someone please assist me in the right path? 

Aug 11, 2022 in Database by Kithuzzz
• 38,000 points
1,732 views

No answer to this question. Be the first to respond.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.

Related Questions In Database

0 votes
2 answers

How to select the nth row in a SQL database table?

SELECT * FROM ( SELECT ID, NAME, ROW_NUMBER() ...READ MORE

answered Apr 23, 2020 in Database by anand
• 140 points
26,388 views
0 votes
1 answer

How to do a batch insert in MySQL

You can try out the following query: INSERT ...READ MORE

answered Sep 10, 2018 in Database by Sahiti
• 6,370 points
2,328 views
0 votes
1 answer

How to cache data in a MVC application?

Reference the System.Web dll in your model ...READ MORE

answered Oct 25, 2018 in Database by Frankie
• 9,830 points
1,845 views
0 votes
1 answer

How to display the queries executed by a particular user in MySQL?

From the version 5.1.7 onward, MySQL allows ...READ MORE

answered Mar 7, 2019 in Database by Mishti
• 480 points
4,412 views
0 votes
2 answers
0 votes
1 answer

How to check if a table exists in a given schema

Since you havent mentioned the DBMS in ...READ MORE

answered Oct 4, 2019 in Database by Daric
• 500 points
2,734 views
0 votes
0 answers
0 votes
1 answer

Java and SQLite

The wikipedia lists some more wrappers: A good tutorial ...READ MORE

answered Dec 21, 2018 in Java by Daisy
• 8,140 points
764 views
0 votes
0 answers
0 votes
0 answers

How to retrieve data from sqlite database in android and display it in TextView

I'm studying Android. I'm having trouble solving ...READ MORE

Aug 11, 2022 in Database by Kithuzzz
• 38,000 points
4,819 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP