I just wasted 5 days for the challenge banging my head trying to figure out why a database that worked with SQLite on Windows would not work on Android. Since we don't have access to the SDK source, I couldn't find the source of the error message: "Bad request for field slot 0,-1". I finally figured out that a table primary key MUST be named "_id" in Android (mine are called ID generally or LINKID depending on the table). (see Note 4. in"Accessing Content Providers" and "android.widget.CursorAdapter: The Cursor must include a column named "_id" or this class will not work". I think that first the example source *SHOULD NOT* use an "_id" but " android.provider.BaseColumns._ID" with a warning and an explanation that the primary key MUST be named that way. It also should be in the sqlite Javadocs, that's where I would have expected them to be.
The "Notepad Tutorial" should have something like: "The primary key MUST be named "_id" and not " _id is named in line with a convention...". I also think that having such a constraint on all tables is very restrictive and not a very good design practice. Fred On Tue, Mar 25, 2008 at 7:34 PM, Fred Janon <[EMAIL PROTECTED]> wrote: > Would anyone be kind enough to tell me in what direction I should > investigate? Does this error mean that my mapping "from" or "to" is wrong or > is it my SQL query? I checked and rechecked all of that and could not find > anything. Apr 14 is approaching way too quickly. > > Thanks > > Fred > > > ---------- Forwarded message ---------- > From: Fred Janon <[EMAIL PROTECTED]> > Date: Mon, Mar 24, 2008 at 4:26 PM > Subject: ListActivity/SimpleCursorAdapter/SQLite issue: > ERROR/CursorWindow(728): Bad request for field slot 0,-1. > To: [EMAIL PROTECTED] > > > during a setListAdapter call: > > SimpleCursorAdapter notes = new SimpleCursorAdapter(this, > R.layout.notes_row, notesCursor, from, to); > setListAdapter(notes); > > I get this error: > > ERROR/CursorWindow(728): Bad request for field slot 0,-1. numRows = 1, > numColumns = 3 > > What does this mean: "slot 0, -1"? Where is the issue? > > Thanks > > Fred > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] Announcing the new M5 SDK! http://android-developers.blogspot.com/2008/02/android-sdk-m5-rc14-now-available.html For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~----------~----~----~----~------~----~------~--~---

