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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T01:51:13+00:00 2026-05-26T01:51:13+00:00

I saw many questions raised for the problem with _id.But my problem is with

  • 0

I saw many questions raised for the problem with _id.But my problem is with other column which is defined in database create query…

public class DatabaseHelper extends SQLiteOpenHelper{

    static final String dbName="Shadows";
    static final String pages="pages";
    static final String pages_id="_id";
    static final String date="date";
    static final String details="details";

    public DatabaseHelper(Context context) {
        super(context, dbName, null, 33);
    }

    public void onCreate(SQLiteDatabase db) {
        db.execSQL("CREATE TABLE IF NOT EXISTS pages (_id INTEGER PRIMARY KEY AUTOINCREMENT, date TEXT, details TEXT);");
    }

    @Override
    public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
        db.execSQL("DROP TABLE IF EXISTS "+pages);
        onCreate(db);
    } 


    public Cursor getallPages(){
        SQLiteDatabase db=this.getReadableDatabase();
        Cursor c=db.rawQuery("SELECT * FROM PAGES", new String[] {});
        return c;
    }
}

now after calling this getPages() function used simple cursor adaptor.

String[] from = new String[]{
    DatabaseHelper.pages_id,
    DatabaseHelper.date,
    DatabaseHelper.details
};
int[] to = new int[]{R.id.id,R.id.name,R.id.mail};
SimpleCursorAdapter sca = new SimpleCursorAdapter(
    this,R.layout.gridview,c,from,to
);

It gives an error “column details does not exists”.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-26T01:51:14+00:00Added an answer on May 26, 2026 at 1:51 am

    Two things.

    You should be using the final static field details in the SQL constructor – this would save you from any minor typo.

    db.execSQL("CREATE TABLE IF NOT EXISTS "+pages+" ("+pages_id+" INTEGER PRIMARY KEY AUTOINCREMENT, "+date+" TEXT, "+details+" TEXT);");
    

    And from the select

     Cursor c=db.rawQuery("SELECT * FROM "+pages, new String[] {});
    

    It’s good practice and also means that should you decide to change something then it’s automatically taken care of.

    But the most likely cause of this is that the database (and table) already exist but in an different format – if you’ve recently changed the code to add or rename the details column then this code wouldn’t drop and recreate the table.

    Simplest test – just clear the data of this app from the device and then run it again – it looks like you’ve been incrementing the database version to do this same thing so are you sure you did that?

    Other than a faulty pre-existing database this looks like it should work.

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

Sidebar

Related Questions

I saw many questions about this, and tried to solve the problem, but after
this is quite frustrating, I saw many questions around this topic, but strangely enough
I saw many similar questions here but their answers don't work for me by
I have looked through as many previous questions as possible but never saw a
I saw many questions asking 'how' to unit test in a specific language, but
Saw this questions asked many times. But couldn't find a reasonable answer. What is
I saw the other topic and I'm having another problem. The process is starting
I found many questions regarding the missing pause/resume feature in the MediaRecorder class. But
I am talking about Device resolution not screen size. I saw many previous questions'
I saw many questions about json in stackoverflow. Most of them are unanswered or

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.