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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T15:33:50+00:00 2026-05-25T15:33:50+00:00

I have a little problem with inserting data in sqlite in Android. I wrote

  • 0

I have a little problem with inserting data in sqlite in Android. I wrote a method which do that with ContentValues,but it’s not working properly. Here is the method :

DatabaseHelper.class

public boolean executeQuery(String tableName,String keys,Object value){
    return execQuery(tableName,keys,value);
}

private static boolean execQuery(String tableName,String key,Object value){
    sqliteDb = instance.getWritableDatabase();
    ContentValues values = new ContentValues();
    values.put(key, value.toString());
    sqliteDb.insert(tableName, null, values);

    return true;

}

And I’m using this like that :

dbHelper.executeQuery("users", "seed", seed); // string
dbHelper.executeQuery("users", "id", id); // int
dbHelper.executeQuery("users", "name", name); // string
dbHelper.executeQuery("users", "lang", lang); // string

And the problem is that I this method insert all values as single row in database,but I want all data to be a part of one row.

What I have to do to get the things to work correctly?
I’m not really good with sqlite,so please excuse me if my question is a little silly…

Thanks in advance!

  • 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-25T15:33:50+00:00Added an answer on May 25, 2026 at 3:33 pm
        private static boolean execQuery(String tableName,String seed,String id,String name, String lang){
    
        sqliteDb = instance.getWritableDatabase();
        ContentValues values = new ContentValues();
            values.put("seed", seed);
            values.put("id", id);
            values.put("name", name);
            values.put("lang", lang);
    
        sqliteDb.insert(tableName, null, values);
    return true;
        }
    
    dbHelper.executeQuery("users",seed,id, name,lang); // string
    

    EDITED

     private void execQuery(String tableName,ContentValues val)
     {
        sqliteDb = instance.getWritableDatabase();       
        sqliteDb.insert(tableName, null, val);
        return true;
     }
    

    call

       ContentValues values = new ContentValues();
            values.put("seed", seed);
            values.put("id", id);
            values.put("name", name);
            values.put("lang", lang);
       dbHelper.executeQuery("users",values); // string 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this little problem, that I cannot figure out which arguments to pass
i have little problem with boost::asio library. My app receive and process data asynchronously,
I have a little problem with a query. I'm selecting data using the between
I have a little problem about using jQuery (I really do not know jQuery
I have a little problem. I had some JComboBox to a JDialog but they
i have a little problem implementing some serialization/deserialization logic. I have several classes that
I have a little problem with plists. I don't know how to read data
Hey most of my issue has been solved but i have little problem This
I have problem with updating my datagridview after inserting new data to table. It
I have a little problem with paperclip saving the data passed through the form...

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.