What does it mean that adb uninstall doesn't work? What is the error message?

Are you using your actual package name instead of <package>?

The "question mark" syntax is for being able to specify SQL statement parameters separately from the statement itself. This separates the SQL statement logic from the values. This is beneficial in several ways, which I will not go into right now.

By using a question mark you're telling SQL that there is a value in this place, but it's specified separately, in the array (the last parameter).

So you'd have:

db.execSQL(
        "INSERT INTO tbl_events VALUES (?,?,?,?,?,?,?,?,?)",
        new Object[] { entryID, eventName, date,<omitted>.... , distance, 
totalScore }
);

Better yet, specify which columns the values are for, like this:


db.execSQL(
        "INSERT INTO tbl_events (entryID, eventName, date,<omitted>) " +
        " VALUES (?,?,?,?,?,?,?,?,?)",
        new Object[] { entryID, eventName, date,<omitted>.... , distance, 
totalScore }
);

-- Kostya


03.09.2010 17:38, kingh32 пишет:
I cant get adb uninstall to work
I'm doing this

adb uninstall<package>
I've also tried

adb uninstall [-k]<package>  and adb uninstall []<package>

In the mean time I've created another database and tried to populate
it with the new queries but it still tells me that I'm trying to
populate an 8 column table with 9 columns.

final String CREATE_TABLE_EVENT = "CREATE TABLE IF NOT EXISTS
tbl_events("
                                + "entryID INTEGER PRIMARY KEY , "
                        + "eventName TEXT,"
                        + "date TEXT,"
                        + "eventType TEXT,"
                        + "numRounds INTEGER,"
                        + "shotsPerRound INTEGER"
                        + "shooter TEXT,"
                        + "distance TEXT,"
                        + "totalScore INTEGER);";


String INSERT_INTO_EVENT = "INSERT INTO tbl_events VALUES"
                                 +"(1,'"
                                 + eventName
                                 +"','"
                                 + date
                                 +"','"
                                 + eventType
                                 +"','"
                                 + numRounds
                                 +"','"
                                 + shotsPerRound
                                 +"','"
                                 + shooter
                                 +"','"
                                 + distance
                                 +"','"
                                 + totalScore +"');";

I've looked at these over and over and there are definitely 9 fields
in each.

I would like to change them to look like your example above but I dont
really understand this construct...

db.execSQL("INSERT INTO tablename VALUES(?, ?, ?)", new String[]
{ valA, valB, valC});

What would I replace the question marks with - sorry if thats a really
silly question!
On Sep 3, 1:35 pm, Kostya Vasilyev<[email protected]>  wrote:
   I believe that one of the columns is still missing, so you get this
error at one of these lines:

cursor.getString(cursor.getColumnIndex("blah"))

Where getColumnIndex() returns -1, because the column is not in the
query results, and getString() is being asked to get the data for column
-1, which is invalid.

- Change your getColumnIndex to getColumnIndexOrThrow, this will let you
see which column is missing in the query

- Cache column indices outisde the loop

- Before running again, uninstall the application with "adb uninstall"
to force the database to be recreated

-- Kostya

03.09.2010 15:24, kingh32 пишет:

E/CursorWindow( 1354): Bad request for field slot 0,-1. numRows = 1,
numColumns
= 2
--
Kostya Vasilyev -- WiFi Manager + pretty widget --http://kmansoft.wordpress.com


--
Kostya Vasilyev -- WiFi Manager + pretty widget -- http://kmansoft.wordpress.com

--
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]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to