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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T01:06:29+00:00 2026-06-01T01:06:29+00:00

I have one table TABLE_EXAM . i need to update the value of specific

  • 0

I have one table TABLE_EXAM. i need to update the value of specific record by passing
id. But my code is not able to update the code. i don’t understand what is wrong in my code.
Please give me some hint or reference…
Thanks in advance..
Here is my code for reference….

public void updateExamDetails(int id,ObjectiveWiseQuestion owq)
{

    SQLiteDatabase db= this.getWritableDatabase();
    String selectQuery=("update exam set (examdetails, subchawise, examtype, noquestion, marks, subject_id, chapter_id) where exam_id ='"+ id +"'");
    Cursor cursor = db.rawQuery(selectQuery, null);

    if (cursor.moveToFirst())
    {
        do {
            ContentValues values = new ContentValues();
            values.put(COLUMN_NO_QUESTION, owq.getNoOfQuestion());
            values.put(COLUMN_MARKS, owq.getMarks());
            values.put(COLUMN_CHAP_ID, owq.getChapterId());
            values.put(COLUMN_SUB_ID, owq.getSubjectId());
            values.put(COLUMN_SUBCHAWISE,owq.getSubChapwise());
            values.put(COLUMN_EXAM_TYPE, owq.getExamType());
            values.put(COLUMN_EXAM_DETAILS, owq.getExamDetails());
            db.insert(TABLE_EXAM, null, values);
            db.close();

        } 
        while (cursor.moveToNext());
    }
}

Logcat have one warning..

WARN/System.err(7227): android.database.sqlite.SQLiteException: near "(": syntax error: , while compiling: update exam set ( examdetails=?, subchawise=?, examtype=?, noquestion=?, marks=?, subject_id=?, chapter_id=? ) where exam_id ='1'
  • 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-06-01T01:06:31+00:00Added an answer on June 1, 2026 at 1:06 am

    This is a standard way of doing it:

    String query = "UPDATE exam SET examdetails = ?, subchawise = ?, examtype = ?, noquestion = ?, marks = ?, subject_id = ?, chapter_id = ? WHERE exam_id = ?";
    
    String[] params = new String[]{owq.getExamDetails(), owq.getSubChapwise(), owq.getExamType(), owq.getNoOfQuestion(), owq.getMarks(), String.valueOf(owq.getSubjectId()), String.valueOf(owq.getChapterId()), id};
    
    db.rawQuery(query, params);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have one table TABLE_QUESTION. I need to fetch record by passing exam_id and
I have one table: CREATE TABLE IF NOT EXISTS `test` ( `firstname` varchar(100) NOT
I have one table with two queries and I need to sort it with
I have one table spread across two servers running MySql 4. I need to
I have one table DataDollar...and 2 columns LineNmbr & DollarAmt in that. I need
I have one table TABLE_SUBJECT which contain a number of subjects. I need to
I have one database table TABLE_TIPS with two value 1. tips_id (auto increment) 2.
I have one table that saves comments for a varied set of content types.
I have one table orders with a foreing key ProductID. I want to show
I have one table having ID and other attributes. How can I get list

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.