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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T14:14:43+00:00 2026-06-12T14:14:43+00:00

In My database I want to retrieve a row from my database . For

  • 0

In My database I want to retrieve a row from my database . For this I write a query :

Cursor mCursor = db.query("Author_table", column_name, "Author_name=?" , params, null , null , null) ;

By this I want to do the following query : “Select AID from Author_table where Author_name = Sultan” . But I have got anexception in SQLiteDatabase in android . Please suggest me what to do ??

  • 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-12T14:14:45+00:00Added an answer on June 12, 2026 at 2:14 pm

    Something like this should work:

    Cursor c = db.query("Author_table", new String[] {"AID"}, "Author_name=?", new String[] {"Sultan"}, null, null, null);
    

    EDIT

    SQLOpenHelper

    import java.io.File;
    
    import android.content.Context;
    import android.database.Cursor;
    import android.database.sqlite.SQLiteDatabase;
    import android.database.sqlite.SQLiteOpenHelper;
    import android.os.Environment;
    
    public class OpenHelper extends SQLiteOpenHelper {
    
        private static final String DATABASE_NAME = "test.db";
        private static final int DATABASE_VERSION = 8;
    
        private static final String CREATE_TABLE_USER = "create table USER( "
                + "username varchar(256) not null, " + "sex varchar(1) not null, "
                + "password varchar(64) not null, " + "active int not null"
                + ");";
    
        public OpenHelper(Context context) {
            super(context, DATABASE_NAME, null, DATABASE_VERSION);
        }
    
        @Override
        public void onCreate(SQLiteDatabase db) {
            db.execSQL(CREATE_TABLE_USER);
        }
    
        @Override
        public void onOpen(SQLiteDatabase db) {
        }
    
        @Override
        public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
    
            if (oldVersion < 8) {
                // db update goes here and in onCreate() (for newly installed apps)
            }
        }
    
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to retrieve values from SQLite database in my Android application. Here in
If I need to retrieve a single row of data from the database, why
I am using datatable to retrieve 1000 records from mysql database. I want to
I've such a situation , want to retrieve row ids from mysql to input
I want to know if it is possible to retrieve a row from the
I'm trying to write a query in php that will select a row from
I want to retrieve a set of records from a database, do a rs.next()
i want to save current date+time into database and also want to retrieve it.
I am working on a database middleware application again. I want to retrieve the
I want applications to share certain database data. I want one application to retrieve

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.