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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T03:01:25+00:00 2026-06-11T03:01:25+00:00

I am trying to retrieve data using query from the sqlite database that was

  • 0

I am trying to retrieve data using query from the sqlite database that was previously populated. But for some reason the query returnscursor with no rows.

So here is the portion where I tried to retrieve data:

        database.open();
    Cursor cursor = database.getComponentData("CONTROLS", null, null);

    int test = cursor.getCount();//This is the part where i test through the eclipse debugger whether there is  any rows return
    cursor.moveToFirst();
    while (!cursor.isAfterLast()) {

        get.append("Video controls : "+cursor.getString(1)+" Audio Controls : "+cursor.getString(2)+" Reader controls : "+cursor.getString(3));
        cursor.moveToNext();
    }
    cursor.close();
    Cursor cursor1 = database.getComponentData("LIST", new String[]{"'URL'"},"AUDIO");

    get.append("Video list : ");
        cursor1.moveToFirst();
    while (!cursor1.isAfterLast()) {

        get.append(" "+cursor1.getString(1)+" "+cursor1.getString(2)+" "+cursor1.getString(3));
        cursor1.moveToNext();

    }
    cursor1.close();
    database.close();

And here is the portion in the database adapter where I queried.

public Cursor getComponentData(String whichTable,String[] whichColumn,String whichSection) {
    Cursor c = null;
    if(whichSection!=null) 
    {   
        return database.query(whichTable, whichColumn,"SECTION = '"+whichSection+"'",null, null, null, null);
    }
    else{
        return database.query(whichTable, whichColumn,null,null, null, null, null);
    }

}

This is the portion where i insert into the database previously:

                 database.open();
               ContentValues control = new ContentValues();
               control.put("VIDEO_CONTROLS",video_control);
               control.put("AUDIO_CONTROLS",audio_control);
               control.put("READER_CONTROLS",book_control);

               control_long =database.insertNewControl(control);

               ContentValues temp_list = new ContentValues();

                a_p=audio_playlist.split(",");
                v_p=video_playlist.split(",");
                b_p=booklist.split(",");
               for(int i =0;i<a_p.length;i++){
                   temp_list.put("NAME", "test");
                   temp_list.put("URL", a_p[i]);
                   temp_list.put("SECTION", "AUDIO");

                list_long=   database.insertNewListRow(temp_list);

               }
               for(int i =0;i<v_p.length;i++){
                  temp_list.put("NAME", "test");
                   temp_list.put("URL", v_p[i]);
                   temp_list.put("SECTION", "VIDEO");
                   list_long=    database.insertNewListRow(temp_list);

                   }
               for(int i =0;i<b_p.length;i++){
                 temp_list.put("NAME", "test");
                   temp_list.put("URL", b_p[i]);
                   temp_list.put("SECTION", "READER");
                   list_long=   database.insertNewListRow(temp_list);

                   }
                database.close();

Insert Methods in the Adapter:

    public Long insertNewControl(ContentValues controls_values) {
return database.insert("CONTROLS", null, controls_values);  
}
public Long insertNewListRow(ContentValues list_values){
return database.insert("LIST", null, list_values);  
}

Thanks for reading.

Edit :
Forgotten to mention this, If I were to query() from the database right after I have inserted these rows, I would be able to get rows out.But I were to query for these rows after I close() and open() again, cursor returns no rows.

  • 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-11T03:01:27+00:00Added an answer on June 11, 2026 at 3:01 am

    I forgotten to post the solution that i found ,

    Basically what happen is that I forgotten to name the database at the constructor of the class where the database and tables were created. epicfacepalm

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

Sidebar

Related Questions

I am trying to retrieve data into an xml tag from the database using
Iam trying to retrieve data from mysql database into stylesheet.php but it is not
Trying to retrieve data using linq from a database. I would like to use
I'm using Hibernate to retrieve some data from a database. The result set returned
I am trying to retrieve a user's foursquare checkin data that is published using
I am trying to retrieve CLOB data from our Oracle database. the code is
I'm trying to retrieve hierarchical data from a table but am failing to do
I am trying to figure out how to retrieve data from a MySQL database
I'm trying to connect to an MSAccess database and retrieve some data. With simple
I am trying to use LINQ to retrieve some data from a dictionary. var

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.