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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T21:45:27+00:00 2026-06-09T21:45:27+00:00

This is my code to create: private static final String TABLE_CURRENT_GAME = current; private

  • 0

This is my code to create:

private static final String TABLE_CURRENT_GAME = "current";
    private static final String C_KEY_ID = "C_id";
    private static final String C_SCORE_1 = "C_score_1";
    private static final String C_SCORE_2 = "C_score_2";
    private static final String C_K_1 = "C_k_1";
    private static final String C_K_2 = "C_k_2";

public void onCreate(SQLiteDatabase db) {
            String CREATE_CURRENT_GAME_TABLE = "CREATE TABLE " + TABLE_CURRENT_GAME + "("
        + C_KEY_ID + " INTEGER PRIMARY KEY," + C_SCORE_1+"INT,"+C_SCORE_2+"INT,"+C_K_1+"INT,"+C_K_2+"INT)";

        db.execSQL(CREATE_CURRENT_GAME_TABLE);
    }

    // Upgrading database
    @Override
    public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
        // Drop older table if existed

        db.execSQL("DROP TABLE IF EXISTS " + TABLE_CURRENT_GAME);
        // Create tables again
        onCreate(db);
    }

and my code for inserting:

void addCurrentGameData(CurrentGameTable data) {
        SQLiteDatabase db = this.getWritableDatabase();

        ContentValues values = new ContentValues();
        values.put(C_SCORE_1, data.getScore1()); // score player1
        values.put(C_SCORE_2, data.getScore2());//score player2
        values.put(C_K_1, data.getKseres1());//kseres player1
        values.put(C_K_2, data.getKseres2());//kseres player2
        // Inserting Row
        db.insert(TABLE_CURRENT_GAME, null, values);
        db.close(); // Closing database connection
    }

where CurrentGameData is my constructor.

Then when trying to insert the table like that:

 DatabaseHandler db = new DatabaseHandler(this);

         /**
          * CRUD Operations
          * */
         // Inserting Contacts
         Log.d("Insert: ", "Inserting ..");
         db.addCurrentGameData(new CurrentGameTable(1,2,3,4));

In my phone I get this error:

08-19 16:36:23.876: E/Database(3996): Error inserting current
08-19 16:36:23.876: E/Database(3996): android.database.sqlite.SQLiteException: table current has no column named C_score_2: , while compiling: INSERT INTO current(C_score_2, C_k_1, C_score_1, C_k_2) VALUES(?, ?, ?, ?);

In my emulator I get this error:

08-19 13:48:19.036: E/AndroidRuntime(519): FATAL EXCEPTION: main
08-19 13:48:19.036: E/AndroidRuntime(519): android.database.sqlite.SQLiteException: no such table: current: , while compiling: SELECT  * FROM current
08-19 13:48:19.036: E/AndroidRuntime(519):  at android.database.sqlite.SQLiteCompiledSql.native_compile(Native Method)

Other table created with the same syntax works properly but this, second one, does not.

  • 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-09T21:45:28+00:00Added an answer on June 9, 2026 at 9:45 pm

    for example :

    C_SCORE_1+"INT,"
    

    create one column named C_score_1INT without type,

    your code shoud be (whith space added):

         String CREATE_CURRENT_GAME_TABLE = "CREATE TABLE " + TABLE_CURRENT_GAME + "("
          + C_KEY_ID + " INTEGER PRIMARY KEY, " + C_SCORE_1+" INT, "+C_SCORE_2+" INT, "+C_K_1+" INT, "+C_K_2+" INT)";
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is my code: private static final String CREATE_VISIT_TABLE = create table + VISIT_TABLE
Why does this code crash? CustomDatabaseHelper.java: public class CustomDatabaseHelper { SQLiteDatabase db; private static
public class BobDatabase extends SQLiteOpenHelper{ private static final String DATABASE_NAME = bob.db; private static
Why, this code create 2 the same columns in grid (Color and Color). How
I'm using this code to create multiple functions wrappers using variadic templates: // Compile
I've written this code to create a list of email addresses from branch numbers.
I wrote this code to create a custom annotation image - (MKAnnotationView *)mapView:(MKMapView *)mapView
I have this code to create an ATOM feed Dim xmlResult As New StringBuilder
I have this code to create a webapp in my server: import web urls
i'm starter in jqgrid, i write this code for create and fill jqgrid(i'm use

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.