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

The Archive Base Latest Questions

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

I am really sorry to ask this silly question. I have been onto this

  • 0

I am really sorry to ask this silly question. I have been onto this error for last 1 hour and could not find the problem from my eyes. If someone can help me find the problem I would really appreciate. I know this is not a error handling blog but I don’t have a choice. Following is my DB code:

private static final String DATABASE_NAME = "RCdata";
private static final String DATABASE_TABLE = "events";
private static final int DATABASE_VERSION = 1;
private static final String TAG = "RCDataBaseAdapter";
private static final String KEY_ROWID = "_id";
private static final String KEY_EVENT = "eventsname";
private static final String KEY_DESCRIPTION ="description";

// Database creation sql statement
private static final String DATABASE_CREATE_EVENTS =
        "create table events (_id integer primary key autoincrement, "
        + "eventsname text not null, " 
        + "description text not null);";


private Context context;
private DatabaseHelper DBHelper;
private SQLiteDatabase db;
      public RCDatabaseAdapter(Context ctx)
{
    //super(ctx, DATABASE_NAME, null, DATABASE_VERSION);
    this.context = ctx;
    DBHelper = new DatabaseHelper(context); 
    // TODO Auto-generated constructor stub
}

private static class DatabaseHelper extends SQLiteOpenHelper 
{
    DatabaseHelper(Context context) 
    {
        super(context, DATABASE_NAME, null, DATABASE_VERSION);
    }   

@Override
public void onCreate(SQLiteDatabase db) {
    // TODO Auto-generated method stub
    db.execSQL(DATABASE_CREATE_EVENTS);
    //db.execSQL(DATABASE_CREATE_Priests);


}

@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
    // TODO Auto-generated method stub
    Log.w(TAG, "Upgrading database from version " + oldVersion 
            + " to "
            + newVersion + ", which will destroy all old data");
      db.execSQL("DROP TABLE IF EXISTS Events");
      onCreate(db);

}
}
//---opens the database---
public RCDatabaseAdapter open() throws SQLException 
{
    db = DBHelper.getWritableDatabase();
    return this;
}

//---closes the database---    
public void close() 
{
    DBHelper.close();
}

public long insertEvent(String eventname, String description)
{
    ContentValues initialValues = new ContentValues();
    initialValues.put(KEY_EVENT, eventname);
    initialValues.put(KEY_DESCRIPTION, description);

    return db.insert(DATABASE_TABLE, null, initialValues);

}


//---deletes a particular event---
public boolean deleteEvent(long rowId) 
{
    return db.delete(DATABASE_CREATE_EVENTS, KEY_ROWID + 
            "=" + rowId, null) > 0;
}


public Cursor getAllTitles() 
{
    return db.query(DATABASE_CREATE_EVENTS, new String[] {
            KEY_ROWID, 
            KEY_EVENT,
            KEY_DESCRIPTION}, 
            null, 
            null, 
            null, 
            null, 
            null);
}

//---retrieves a particular title---
public Cursor getEvent(long rowId) throws SQLException 
{

    Cursor mCursor =
            db.query(true, DATABASE_CREATE_EVENTS, new String[] {
                    KEY_ROWID,
                    KEY_EVENT, 
                    KEY_DESCRIPTION                     
                    }, 
                    KEY_ROWID + "=" + rowId, 
                    null,
                    null, 
                    null, 
                    null, 
                    null);
    if (mCursor != null) {
        mCursor.moveToFirst();
    }
    return mCursor;                  


}

I am getting the following error:

near “create”: syntax error: ,
while compiling: SELECT _id,
eventsname, description
FROM create table events (_id
integer primary key
autoincrement, eventsname
text not null, description text
not null);
  • 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:55:39+00:00Added an answer on May 27, 2026 at 10:55 am

    your methods of getAllTitles, deleteEvent, getEvent all use the create syntax in a query to get records. You need to pass the appropriate syntax to the query method. Documentation here
    An example, your getEvent method might work like this.

    db.query(true, "events", new String[] {
                        KEY_ROWID,
                        KEY_EVENT, 
                        KEY_DESCRIPTION                     
                        }, 
                        KEY_ROWID + "=" + rowId, 
                        null,
                        null, 
                        null, 
                        null, 
                        null);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm sorry if this is not really an appropriate question to ask on here,
I'm really sorry to have to ask this, but I clearly don't understand something
Sorry, I'm not really sure of the right way to ask this one so
Sorry if this is a really basic question but it's been really getting to
Sorry if this is not a programming question, but I'm not really sure where
Sorry if this has been asked before or it's a really dumb question, but
Okay I'm really sorry if this question has been asked, but I can't seem
Really stupid question, sorry, but I can't find it on google (I'm sure it's
Sorry if is a dummy question but I'm not really clear with it. Is
I'm really new to VSTO so sorry if this is a newbie question. I'm

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.