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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T23:27:45+00:00 2026-06-02T23:27:45+00:00

How to make this line work? return ourDatabase.rawQuery(SELECT * FROM GL_ + tablename +

  • 0

How to make this line work?

return ourDatabase.rawQuery("SELECT * FROM GL_" + tablename + " WHERE " + KEY_GROUP_T + " = " + grp + " ORDER BY " + KEY_NAME_T + " COLLATE NOCASE", null);

04-23 17:58:26.701: E/AndroidRuntime(9212): Caused by:
android.database.sqlite.SQLiteException: no such column: Baked_Goods:
, while compiling: SELECT * FROM GL_table4 WHERE grlist_group =
Baked_Goods ORDER BY grlist_name COLLATE NOCASE

This line is working but I want to do it with rawQuery:

return ourDatabase.query("GL_" + tablename, columns, KEY_GROUP_T + "= ?" , new String[]{grp}, null, null, null);
  • 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-02T23:27:46+00:00Added an answer on June 2, 2026 at 11:27 pm

    To make this work, you have to put single-quotes around your strings. Example:

    return ourDatabase.rawQuery("SELECT * FROM GL_" + tablename + " WHERE " + KEY_GROUP_T + " = '" + grp + "' ORDER BY " + KEY_NAME_T + " COLLATE NOCASE", null);
    

    Addition

    Waqas has a good point if grp is taken from the user’s input, he is preventing a SQL insertion attack. If you always define grp, then it isn’t critical but good practice.

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

Sidebar

Related Questions

I'm not being able to make this line work with Tk import os while(1):
Is it possible to make this line of code valid? description, content, state, city,
Is there a way to make this line shorter? bool pass = d !=
Unless I make static CPaintDC dc(this); the line won't draw? But this is not
I need to make this function work everywhere, except IE6-7 $(function(){ window.scrollTo(0,300); }) Please
Here's the code. Is it possible to make last line work? #include<iostream> using namespace
I want to make this code work properly, what should I do? giving this
I have tried so many things to make this work and I have failed
I've been driving myself crazy trying to make this work. Variations of my attempt
I can't seem to make Perl's flock work. I'm locking a file, checking return

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.