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

  • Home
  • SEARCH
  • 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 8662793
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T16:49:04+00:00 2026-06-12T16:49:04+00:00

Below is the code i am using..and also the error it has displayed.. I

  • 0

Below is the code i am using..and also the error it has displayed.. I have gone through each line of code, but i couldnt figure it out.. please help me..

public class CenterCollectionDatabase extends Activity {

public static final String KEY_ID = "id";
public static final String KEY_ROUNDID = "round";
public static final String KEY_PLAYERID = "playerid";
public static final String KEY_MAAL = "maal";
public static final String KEY_POINT = "point";
public static final String KEY_WON = "won";
private static final String DATABASE_NAME ="center_collection";
private static final String DATABASE_TABLE= "transaction";
private static final int DATABASE_VERSION = 1;
private DbHelper ourHelper;
private final Context ourContext;
private SQLiteDatabase ourDatabase;

private static class DbHelper extends SQLiteOpenHelper{

    public DbHelper(Context context) {
        super(context, DATABASE_NAME, null, DATABASE_VERSION);
        // TODO Auto-generated constructor stub
    }

    @Override
    public void onCreate(SQLiteDatabase db) {
        // TODO Auto-generated method stub

        db.execSQL("CREATE TABLE " + DATABASE_TABLE +" ("+
                KEY_ID + " INTEGER PRIMARY KEY AUTOINCREMENT, "+
                KEY_ROUNDID + " INTEGER, "+
                KEY_PLAYERID + " INTEGER, "+
                KEY_POINT + " INTEGER, "+
                KEY_MAAL + " INTEGER, "+
                KEY_WON+ " INTEGER );"          
            );
    }

    @Override
    public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
        // TODO Auto-generated method stub

        db.execSQL("DROP TABLE IF EXISTS " + DATABASE_TABLE);
        onCreate(db);
    }

}

public CenterCollectionDatabase(Context c)
{
    ourContext = c;
}

public CenterCollectionDatabase open() throws SQLException{
    ourHelper = new DbHelper(ourContext);
    ourDatabase = ourHelper.getWritableDatabase();
    return this;

}
public void close()
{
    ourHelper.close();
}

public long add_score(int round, int playerid, int point, int maal, int won) {

    ContentValues cv = new ContentValues();
    cv.put(KEY_ROUNDID, round);
    cv.put(KEY_PLAYERID, playerid);
    cv.put(KEY_POINT, point);
    cv.put(KEY_MAAL, maal);
    cv.put(KEY_WON, won);

    return ourDatabase.insert(DATABASE_TABLE, null, cv);
}
   }

below is the code used to save data in database

if(counter>0)
            {
                Toast.makeText(getApplicationContext(), "Oops Mike! please fill all fields", Toast.LENGTH_SHORT).show();
            }else{

                CenterCollectionDatabase db = new CenterCollectionDatabase(ScoreEntry.this);
                db.open();

                for(int i=0; i<number_of_player; i++)
                {
                    int round = 1;
                    int playerid = i;
                    int point = Integer.parseInt(Spoint[i]);
                    int maal = Integer.parseInt(Smaal[i]);
                    int won_who = 0;

                    db.add_score(round, playerid, point, maal, won_who);

                }
                db.close();

                Toast.makeText(getApplicationContext(), "Record Sucessfully Saved", Toast.LENGTH_SHORT).show();

                Intent intent = new Intent(ScoreEntry.this, ScoreBoard.class);
                startActivity(intent);

            }

Below is the error

10-09 23:25:52.342: E/AndroidRuntime(584): FATAL EXCEPTION: main
10-09 23:25:52.342: E/AndroidRuntime(584): android.database.sqlite.SQLiteException: near "transaction": syntax error: CREATE TABLE transaction (id INTEGER PRIMARY KEY AUTOINCREMENT, round INTEGER, playerid INTEGER, point INTEGER, maal INTEGER, won INTEGER );
10-09 23:25:52.342: E/AndroidRuntime(584):  at android.database.sqlite.SQLiteDatabase.native_execSQL(Native Method)
10-09 23:25:52.342: E/AndroidRuntime(584):  at android.database.sqlite.SQLiteDatabase.execSQL(SQLiteDatabase.java:1727)
10-09 23:25:52.342: E/AndroidRuntime(584):  at com.vivek.marriage_center_collection.CenterCollectionDatabase$DbHelper.onCreate(CenterCollectionDatabase.java:41)
10-09 23:25:52.342: E/AndroidRuntime(584):  at android.database.sqlite.SQLiteOpenHelper.getWritableDatabase(SQLiteOpenHelper.java:106)
10-09 23:25:52.342: E/AndroidRuntime(584):  at com.vivek.marriage_center_collection.CenterCollectionDatabase.open(CenterCollectionDatabase.java:68)
10-09 23:25:52.342: E/AndroidRuntime(584):  at com.vivek.marriage_center_collection.ScoreEntry$1.onClick(ScoreEntry.java:133)
10-09 23:25:52.342: E/AndroidRuntime(584):  at android.view.View.performClick(View.java:2408)
10-09 23:25:52.342: E/AndroidRuntime(584):  at android.view.View$PerformClick.run(View.java:8816)
10-09 23:25:52.342: E/AndroidRuntime(584):  at android.os.Handler.handleCallback(Handler.java:587)
10-09 23:25:52.342: E/AndroidRuntime(584):  at android.os.Handler.dispatchMessage(Handler.java:92)
10-09 23:25:52.342: E/AndroidRuntime(584):  at android.os.Looper.loop(Looper.java:123)
10-09 23:25:52.342: E/AndroidRuntime(584):  at android.app.ActivityThread.main(ActivityThread.java:4627)
10-09 23:25:52.342: E/AndroidRuntime(584):  at java.lang.reflect.Method.invokeNative(Native Method)
10-09 23:25:52.342: E/AndroidRuntime(584):  at java.lang.reflect.Method.invoke(Method.java:521)
10-09 23:25:52.342: E/AndroidRuntime(584):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
10-09 23:25:52.342: E/AndroidRuntime(584):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
10-09 23:25:52.342: E/AndroidRuntime(584):  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-06-12T16:49:06+00:00Added an answer on June 12, 2026 at 4:49 pm

    I think the problem is the name of your table. That is a keyword in sqlite, so you can’t use it as a table name.

    From the link: “… The SQL standard specifies a huge number of keywords which may not be used as the names of tables …”

    SQLite docs

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

Sidebar

Related Questions

Referencing the code below, I have a list of Error objects that has been
I have the code below: using (SqlCommand command = new SqlCommand()) { command.CommandType =
I am using below code to upload excel and INSERT in mysql in php
I am using below code to get profile image of friends using Resfb. I
I am using below code to generate photo gallery from a folder. How can
I'm using below code to check some form fields and render datatable table on
I am using below code to show jquery dialog, its working perfectly, Sub OpenDialog(ByVal
i am using below code to change the the font type of text view.
I am using below code to create a reminder in Google calendar (using Google
I am using below code for Embed MP3 Audio Files In Web Pages, <embed

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.