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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T10:11:41+00:00 2026-05-27T10:11:41+00:00

I am trying to update a row in my database with 3 values but

  • 0

I am trying to update a row in my database with 3 values but I keep getting a syntax error and I am not sure why, everything looks fine to me.

12-12 12:14:59.800: E/AndroidRuntime(21175): FATAL EXCEPTION: main
12-12 12:14:59.800: E/AndroidRuntime(21175): java.lang.IllegalStateException: Could not execute method of the activity
12-12 12:14:59.800: E/AndroidRuntime(21175):    at android.view.View$1.onClick(View.java:2695)
12-12 12:14:59.800: E/AndroidRuntime(21175):    at android.view.View.performClick(View.java:3122)
12-12 12:14:59.800: E/AndroidRuntime(21175):    at android.view.View$PerformClick.run(View.java:12020)
12-12 12:14:59.800: E/AndroidRuntime(21175):    at android.os.Handler.handleCallback(Handler.java:587)
12-12 12:14:59.800: E/AndroidRuntime(21175):    at android.os.Handler.dispatchMessage(Handler.java:92)
12-12 12:14:59.800: E/AndroidRuntime(21175):    at android.os.Looper.loop(Looper.java:132)
12-12 12:14:59.800: E/AndroidRuntime(21175):    at android.app.ActivityThread.main(ActivityThread.java:4126)
12-12 12:14:59.800: E/AndroidRuntime(21175):    at java.lang.reflect.Method.invokeNative(Native Method)
12-12 12:14:59.800: E/AndroidRuntime(21175):    at java.lang.reflect.Method.invoke(Method.java:491)
12-12 12:14:59.800: E/AndroidRuntime(21175):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:844)
12-12 12:14:59.800: E/AndroidRuntime(21175):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:602)
12-12 12:14:59.800: E/AndroidRuntime(21175):    at dalvik.system.NativeStart.main(Native Method)
12-12 12:14:59.800: E/AndroidRuntime(21175): Caused by: java.lang.reflect.InvocationTargetException
12-12 12:14:59.800: E/AndroidRuntime(21175):    at java.lang.reflect.Method.invokeNative(Native Method)
12-12 12:14:59.800: E/AndroidRuntime(21175):    at java.lang.reflect.Method.invoke(Method.java:491)
12-12 12:14:59.800: E/AndroidRuntime(21175):    at android.view.View$1.onClick(View.java:2690)
12-12 12:14:59.800: E/AndroidRuntime(21175):    ... 11 more
12-12 12:14:59.800: E/AndroidRuntime(21175): Caused by: android.database.sqlite.SQLiteException: near "Smith": syntax error: , while compiling: UPDATE bowlers_table SET team_pos=?,substitute=?,team=? WHERE name=Joe Smith
12-12 12:14:59.800: E/AndroidRuntime(21175):    at android.database.sqlite.SQLiteCompiledSql.native_compile(Native Method)
12-12 12:14:59.800: E/AndroidRuntime(21175):    at android.database.sqlite.SQLiteCompiledSql.<init>(SQLiteCompiledSql.java:64)
12-12 12:14:59.800: E/AndroidRuntime(21175):    at android.database.sqlite.SQLiteProgram.compileSql(SQLiteProgram.java:146)
12-12 12:14:59.800: E/AndroidRuntime(21175):    at android.database.sqlite.SQLiteProgram.compileAndbindAllArgs(SQLiteProgram.java:367)
12-12 12:14:59.800: E/AndroidRuntime(21175):    at android.database.sqlite.SQLiteStatement.acquireAndLock(SQLiteStatement.java:253)
12-12 12:14:59.800: E/AndroidRuntime(21175):    at android.database.sqlite.SQLiteStatement.executeUpdateDelete(SQLiteStatement.java:83)
12-12 12:14:59.800: E/AndroidRuntime(21175):    at android.database.sqlite.SQLiteDatabase.updateWithOnConflict(SQLiteDatabase.java:1829)
12-12 12:14:59.800: E/AndroidRuntime(21175):    at android.database.sqlite.SQLiteDatabase.update(SQLiteDatabase.java:1780)
12-12 12:14:59.800: E/AndroidRuntime(21175):    at com.tyczj.bowling.BowlersDB.update(BowlersDB.java:146)
12-12 12:14:59.800: E/AndroidRuntime(21175):    at android.content.ContentProvider$Transport.update(ContentProvider.java:233)
12-12 12:14:59.800: E/AndroidRuntime(21175):    at android.content.ContentResolver.update(ContentResolver.java:847)
12-12 12:14:59.800: E/AndroidRuntime(21175):    at com.tyczj.bowling.Teams.addToTeam(Teams.java:73)
12-12 12:14:59.800: E/AndroidRuntime(21175):    ... 14 more

here is where I update

    public void addToTeam(View v){
    TextView tv = (TextView)findViewById(R.id.bowlersNameTV);
    EditText et = (EditText)findViewById(R.id.posET);
    CheckBox cb = (CheckBox)findViewById(R.id.checkBox1);
    int pos =  Integer.valueOf(et.getText().toString());
    int sub = 0;
    if(cb.isSelected())
        sub = 1;
    ContentValues val = new ContentValues();
    val.put(BowlersDB.TEAM,teamEdited);
    val.put(BowlersDB.POSITION,pos);
    val.put(BowlersDB.SUB,sub);
    getContentResolver().update(BowlersDB.CONTENT_URI,val,BowlersDB.NAME + "=" + tv.getText().toString(),null);
}

and this is my content provider update

@Override
public int update(Uri uri, ContentValues values, String selection,
        String[] selectionArgs) {
    int count = 0;
    int num = uriMatcher.match(uri);
    if(num == 1){
        count = db.update(BOWLERS_TABLE, values, selection, selectionArgs);
    }else if(num == 2){
        count = db.update(BOWLERS_TABLE, values, ID + " = " + uri.getPathSegments().get(1) + (!TextUtils.isEmpty(selection) ? " AND (" + 
                  selection + ')' : ""), 
                  selectionArgs);
    }else{
        throw new IllegalArgumentException(
                "Unknown URI " + uri);
    }
    getContext().getContentResolver().notifyChange(uri, null);
    return count;
}

where is my syntax wrong? the error tells me its near the end of the last name but thats 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-27T10:11:41+00:00Added an answer on May 27, 2026 at 10:11 am

    🙂
    Caused by: android.database.sqlite.SQLiteException: near “Smith”: syntax error: , while compiling: UPDATE bowlers_table SET team_pos=?,substitute=?,team=? WHERE name=Joe Smith

    you should enclose Joe Smith in quotes.
    in this line
    getContentResolver().update(BowlersDB.CONTENT_URI,val,BowlersDB.NAME + “=” + tv.getText().toString(),null);

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

Sidebar

Related Questions

I'm trying to update a hashtable in a loop but getting an error: System.InvalidOperationException:
I'm trying to call a row update from php to an mysql database. It
I'm trying to do a single row insert/update on a table but all the
Trying to simple update a row in an SQLiteDatabase Database. I can insert records
I trying to update a model on a callback but the validation is causing
So I'm trying to update an object in my MS SQL 2005 database using
On our live/production database I'm trying to add a trigger to a table, but
I am trying to update a cell in a row of a data base.
I'm trying to update the records in a column within database. My current codes
I am trying to store some parsed feed contents values in Sqlite database table

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.