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 6042933
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T06:50:41+00:00 2026-05-23T06:50:41+00:00

So I have data in my database & the value of category is set

  • 0

So I have data in my database & the value of category is set to “Breakfast“

When I execute the below Query with whereClause as

1:final String whereClause = RECIPE_ID + “=1”;

It returns me the data for that RECIPE_ID

But when I execute the query with whereClause as

2:final String whereClause = RECIPE_CATEGORY + “='” + category.trim() + “‘”;

It doesn’t return anything… So I guess my code is working fine as it returns result
RECIPE_ID but I donno why it doesn’t return data for the 2nd whereClause

Hope this makes sense..

final String whereClause = RECIPE_CATEGORY + "='" + category.trim() + "'";
        // ask the database object to create the cursor.
        cursor = db.query(
                RECIPE_TABLE,
                new String[]{
                            RECIPE_ID, 
                            RECIPE_CATEGORY,
                            RECIPE_THIS_TITLE,
                            RECIPE_THIS_SUBTITLE,
                            RECIPE_THIS_DESCRIPTION,
                            RECIPE_THIS_IMAGE,          
                            RECIPE_THIS_CALORIES,
                            RECIPE_THIS_FAT,
                            RECIPE_THIS_SATURATED,
                            RECIPE_THIS_TRANS,
                            RECIPE_THIS_CARBS,
                            RECIPE_THIS_SODIUM,
                            RECIPE_THIS_SUGARS,
                            RECIPE_THIS_SERVINGS,
                            RECIPE_THIS_COSTPERSERVING,
                            RECIPE_THIS_INSTRUCTIONS,
                            RECIPE_THAT_TITLE,
                            RECIPE_THAT_CALORIES,
                            RECIPE_THAT_FAT,
                            RECIPE_THAT_SATURATED,
                            RECIPE_THAT_TRANS,
                            RECIPE_THAT_CARBS,
                            RECIPE_THAT_SODIUM,
                            RECIPE_THAT_SUGARS,
                            RECIPE_THAT_PRICE
                        },
                        whereClause, null, null, null, null
        );

The above code will not return any results. Is anything wrong with it?

  • 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-23T06:50:42+00:00Added an answer on May 23, 2026 at 6:50 am

    You really need to form a question here. Posting code does you no good. If your question is as you title implies, then yes you can do a search clause as a string. Just leave out the where. eg dataId = 5 where ‘where’ is implied.

    Edit: to address the question at the bottom that I missed, multiple things could be wrong. One may be that you dont have any data in the database. Or the where clause is executed and none of your data fits the criteria. Check your database. We can’t help with that.

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

Sidebar

Related Questions

I have data stored as below in an MS Access database: Date User 20090101
I have the following C# code, which pulls data from a database & populates
I have a set of data inside a database which has been input with
I have some code that changes a value of some data within my database
I have some data in a database that I need represented in an XML
I have data in an SQL Server 2005 database which I need to copy
I have taken char data into database into array. now i want to convert
I have taken the data from database into array now I want it to
I have live data in a database i want to tweet data in real
I have data in this format coming from a database... BUS 101S Business and

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.