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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T18:52:26+00:00 2026-05-26T18:52:26+00:00

I am storing some values that I am getting from server in the database

  • 0

I am storing some values that I am getting from server in the database but when i insert values into database It gives me following exception:

   android.database.sqlite.SQLiteException: bind or column index out of range

I am using the following code for it:

       private static final String INSERT = "insert into " 
         + DATABASE_TABLE + "(type,width,height,encoding,data,iid)"+" values (?,?,?,?,?,?)";


     public WineDatabaseAdapter(Context context) {
          this.context = context;
       WineDatabaseHelper openHelper = new WineDatabaseHelper(context);
       this.db=openHelper.getWritableDatabase();
      this.insertStmt=this.db.compileStatement(INSERT);
       }


public long insert(String KEY_TYPE ,String KEY_WIDTH,String KEY_HEIGHT, String KEY_ENCODING,String KEY_DATA,String KeyIId){
           this.insertStmt.bindString(0, KEY_TYPE);
           this.insertStmt.bindString(1, KEY_WIDTH);
           this.insertStmt.bindString(2, KEY_HEIGHT);
           this.insertStmt.bindString(3, KEY_ENCODING);
           this.insertStmt.bindString(4, KEY_DATA);
           this.insertStmt.bindString(5, KeyIId);
           return this.insertStmt.executeInsert();
       }

and I am inserting values in other class :

    db = new WineDatabaseAdapter(HomePageWithPhoneIsOfflineDialog.this);
  db.insert( type,width, height,encoding, data1,iid);

and following is the stacktrace:

         11-03 17:32:15.406: WARN/System.err(22895): android.database.sqlite.SQLiteException: bind or column index out of range: handle 0x319db0
        11-03 17:32:15.406: WARN/System.err(22895):     at android.database.sqlite.SQLiteProgram.native_bind_string(Native Method)
        11-03 17:32:15.406: WARN/System.err(22895):     at android.database.sqlite.SQLiteProgram.bindString(SQLiteProgram.java:244)
        11-03 17:32:15.406: WARN/System.err(22895):     at com.emx.Winwcountry.database.WineDatabaseAdapter.insert(WineDatabaseAdapter.java:52)
        11-03 17:32:15.406: WARN/System.err(22895):     at com.emx.Winwcountry.HomePageWithPhoneIsOfflineDialog$1.onClick(HomePageWithPhoneIsOfflineDialog.java:144)
       11-03 17:32:15.406: WARN/System.err(22895):     at com.android.internal.app.AlertController$ButtonHandler.handleMessage(AlertController.java:159)
         11-03 17:32:15.406: WARN/System.err(22895):     at android.os.Handler.dispatchMessage(Handler.java:99)
        11-03 17:32:15.406: WARN/System.err(22895):     at android.os.Looper.loop(Looper.java:130)
      11-03 17:32:15.406: WARN/System.err(22895):     at android.app.ActivityThread.main(ActivityThread.java:3683)
         11-03 17:32:15.406: WARN/System.err(22895):     at java.lang.reflect.Method.invokeNative(Native Method)
       11-03 17:32:15.406: WARN/System.err(22895):     at java.lang.reflect.Method.invoke(Method.java:507)
       11-03 17:32:15.406: WARN/System.err(22895):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
          11-03 17:32:15.406: WARN/System.err(22895):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
         11-03 17:32:15.406: WARN/System.err(22895):     at dalvik.system.NativeStart.main(Native Method)
  • 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-26T18:52:26+00:00Added an answer on May 26, 2026 at 6:52 pm

    I think it is pretty straight forward. Just read the error.

    bind or column index out of range

    You have 6 ? in your string :

     private static final String INSERT = "insert into " 
         + DATABASE_TABLE + "(type,width,height,encoding,data,iid)"+" values (?,?,?,?,?,?)";
    

    and you are trying to bind a column with index 7 here :

    this.insertStmt.bindString(7, KeyIId);
    

    Edit:
    The index used by bindString is 1-based, so you have to start your index from 1.

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

Sidebar

Related Questions

I'm considering storing some date values as ints. i.e 201003150900 Excepting the fact that
I'm having trouble getting the following to work in SQL Server 2k, but it
I've got an application that's using string.compare(string,string) to sort some values. The thing I
I parse some values from an xml file. There is a @25-12-2010'T'23:40:00 string with
I have created a custom Server control that processes some data, stores that data
In my java code,I am retrieving some multibyte data from database and making some
I'm getting a JSON response from the server and i have to loop through
I want to send some values from my iPhone application to an ASp.Net web
I'm struggling getting the JSON string that was sent from a web page to
I store some time values in sqlite in %H:%M string format (for example 15:43),

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.