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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T13:08:16+00:00 2026-05-31T13:08:16+00:00

i am working on an android database application and have fired query like this

  • 0

i am working on an android database application and have fired query like this

public Cursor strok(String holid, String gameId2) throws SQLException  {
            // TODO Auto-generated method stub

            try{



                abc = db.rawQuery("select MAX(strokeNo) from extended where "
                         + " holeId = " + holid + "  and " + " courseId = " + gameId2+";"
                          ,null);

                    }

                catch(Exception e)

                       {

                          Log.e("ERROR OF HOLE ID IS ",  e.toString());
                           e.printStackTrace();

                        }

                        System.out.println("hello " + abc);

                return abc;
        }

and receiving in the activity like this

  Cursor cursor = db.strok(HoleIds.get(n),gameId);

                    System.out.println("after query ");

                    cursor.moveToFirst();

                startManagingCursor(cursor);

                System.out.println("the recived value is " +cursor);

        String maxs = cursor.getString(cursor.getColumnIndex("strokeNo"));
                    System.out.println("the recived value is " +maxs);

but it is giving an error which i have not been able to find it out

the log cat is

03-20 11:43:43.396: E/CursorWindow(6138): Bad request for field slot 0,-1. numRows = 1, numColumns = 1
03-20 11:43:43.396: E/ERROR OF HOLE ID IS(6138): java.lang.IllegalStateException: get field slot from row 0 col -1 failed
03-20 11:43:43.396: W/System.err(6138): java.lang.IllegalStateException: get field slot from row 0 col -1 failed
03-20 11:43:43.526: W/System.err(6138):     at android.database.CursorWindow.getString_native(Native Method)
03-20 11:43:43.526: W/System.err(6138):     at android.database.CursorWindow.getString(CursorWindow.java:329)
03-20 11:43:43.526: W/System.err(6138):     at android.database.AbstractWindowedCursor.getString(AbstractWindowedCursor.java:49)
03-20 11:43:43.526: W/System.err(6138):     at golf.score.project.ExtendedScoreDisplay.onCreate(ExtendedScoreDisplay.java:123)
03-20 11:43:43.536: W/System.err(6138):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
03-20 11:43:43.556: W/System.err(6138):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
03-20 11:43:43.556: W/System.err(6138):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
03-20 11:43:43.556: W/System.err(6138):     at android.app.ActivityThread.access$2300(ActivityThread.java:125)
03-20 11:43:43.556: W/System.err(6138):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
03-20 11:43:43.567: W/System.err(6138):     at android.os.Handler.dispatchMessage(Handler.java:99)
03-20 11:43:43.577: W/System.err(6138):     at android.os.Looper.loop(Looper.java:123)
03-20 11:43:43.598: W/System.err(6138):     at android.app.ActivityThread.main(ActivityThread.java:4627)
03-20 11:43:43.598: W/System.err(6138):     at java.lang.reflect.Method.invokeNative(Native Method)
03-20 11:43:43.606: W/System.err(6138):     at java.lang.reflect.Method.invoke(Method.java:521)
03-20 11:43:43.606: W/System.err(6138):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
03-20 11:43:43.606: W/System.err(6138):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
03-20 11:43:43.606: W/System.err(6138):     at dalvik.system.NativeStart.main(Native Method)

i want to know where the error is and how to remove it

  • 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-31T13:08:17+00:00Added an answer on May 31, 2026 at 1:08 pm
     abc = db.rawQuery("select MAX(strokeNo) from extended where "
                             + " holeId = " + holid + "  and " + " courseId = " + gameId2+";"
                              ,null);
    

    when it comes to where clause in Sql, you should know String must be surrounded by ‘.

    abc = db.rawQuery("select MAX(strokeNo) from extended where "
                             + " holeId = '" + holid + "'  and " + " courseId = '" + gameId2+"';"
                              ,null);
    

    EDITED:

    As in your sql query you had select only one field so cursor will have only one field

    String maxs = cursor.getString(0);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am working on a Android APP. In this application I have window for
I'm working on an application which uses SQLite Database on Android.I have a custom
I am working on designing an Android application, and I have several questions I
I am working on Android database type application. We need to show some reports.
all i am working on one application in which i have to used database.
I am working on an android application that pulls data from a Database. I
I'm working on my first android app and have an SQLite database set up
I have an Android application that installs a database (~2000 rows across all tables)
I have to set up 2 database for one application. I did & working
I am working on an android application. In which i have slideShows. I am

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.