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

  • Home
  • SEARCH
  • 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 6718057
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T08:55:29+00:00 2026-05-26T08:55:29+00:00

its my first question here on this site. well i have a problem regarding

  • 0

its my first question here on this site.
well i have a problem regarding update query.

  ContentValues args = new ContentValues();
  args.put("j_id", str);

  db.update(TABLE_NAME2, args, null, null);

i just want to add “where” clause into it.

like

   UPDATE TABLE_NAME2
   SET j_id=str
   WHERE j_id = '-1'

So what should i do?

  • 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-05-26T08:55:30+00:00Added an answer on May 26, 2026 at 8:55 am

    Instead of passing null as the third argument, you can pass the WHERE-clause. See the docs.


    In your case, this would look like this:

    String value = "-1"; // Or something else
    String column = "j_id"; // The Column for the WHERE-clause
    db.update(TABLE_NAME2, args, column+" = ?", new String[]{value});
    

    You should always use the prepared-statement syntax. Thus, you don’t actually add the value for the WHERE-clause in the String but use the fourth argument which takes a String-array to replace the ? in the WHERE-query-string.

    The first element of the String-array is replaced with the first ? in the query-string and so on. So in the end, this creates a WHERE-clause like this:

    WHERE j_id = '-1'
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

it's my first question here, glad to have found this site. My question deals
Note: Move this question to other site if you think its not suite here
This question is related to others I have asked on here, mainly regarding sorting
First question here and can I start by saying how much help this site
This is my first question. Thanks to everyone who contributes to this site, it's
It's my first time asking here (I have visited the site several times, but
This question is similar to the one i asked here . But its related
This is my first time asking a question, please be gentle! I have a
Simple problem, though apparently not a simple solution. Example here: http://myhideout.eu/new/ Basically the site
first time posting here, but god know's I use this site to search for

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.