Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7707635
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T00:24:35+00:00 2026-06-01T00:24:35+00:00

I am trying to update the database to show that something has been uploaded.

  • 0

I am trying to update the database to show that something has been uploaded. At the end of the method where I have uploaded the information I have the following code to change a column value from 0 to 1 where 1 means that something has been uploaded but I am getting an error.

Here is what my code looks like:

ContentValues cv = new ContentValues();
cv.put(ProviderMetaData.TableMetaData.HAS_UPLOADED, "1");
String where = ProviderMetaData.TableMetaData._ID + "=" + contenturi;
String[] value = {"0"};
ContentResolver cr = this.mContext.getContentResolver();
cr.update(ProviderMetaData.TableMetaData.CONTENT_URI, cv, where, value);

and the error message I am getting is as follows:

  Error upldating hasupladed=1 using UPDATE tablename SET hasuploaded=? WHERE _id=1

Does anyone see the error here or know what I am doing wrong?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T00:24:38+00:00Added an answer on June 1, 2026 at 12:24 am

    I am not sure of what is the value of the variable contenturi, but you do not need it there. If I am not wrong the correct code you need is either:

    ContentValues cv = new ContentValues();
    cv.put(ProviderMetaData.TableMetaData.HAS_UPLOADED, "1");
    String where = ProviderMetaData.TableMetaData._ID + "= ?";
    String[] value = {"0"};
    ContentResolver cr = this.mContext.getContentResolver();
    cr.update(ProviderMetaData.TableMetaData.CONTENT_URI, cv, where, value);
    

    Or even:

    ContentValues cv = new ContentValues();
    cv.put(ProviderMetaData.TableMetaData.HAS_UPLOADED, "1");
    String where = ProviderMetaData.TableMetaData._ID + "= ?";
    String[] value = {String.valueOf(contenturi)};
    ContentResolver cr = this.mContext.getContentResolver();
    cr.update(ProviderMetaData.TableMetaData.CONTENT_URI, cv, where, value);
    

    Depending on whether you want the id set dynamically or not.

    The main difference between my code and yours is that I use the where arguments as they are meant to be used – in the where caluse you place question marks on the places where their values are to be inserted and then Android SQLiteDatabase substitutes their values accordingly.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a SQL Server 2005 database that I'm trying to access as a
i've been trying to create a vb6 code that will randomize 10 questions but
I'm trying to update a field in the database to the sum of its
So I'm trying to update an object in my MS SQL 2005 database using
I'm trying to call a row update from php to an mysql database. It
Hi iam trying to make an update trigger in my database. But i get
I have been trying to figure out how to do this and it seems
I'm trying to catch an android.database.sqlite.SQLiteException: error code 5: database is locked exception with:
I have a test server that uses data from a test database. When I'm
I'm using Oledb as my database and I'm trying to update the Status column

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.