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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T01:33:12+00:00 2026-05-23T01:33:12+00:00

I tried one simple application in android… to store the database but while add

  • 0

I tried one simple application in android… to store the database

but while add am getting error like below enter image description here

Logcat error:06-11 14:27:32.157: ERROR/Database(523): Failure 1 (near "FROM": syntax error) on 0x2685c0 when preparing 'CREATE VIEW ViewTasks AS SELECT TaskTable.TaskID AS _id, TaskTable.TaskName, TaskTable.StartDate, TaskTable.EndDate, TaskTable.Desi, FROM TaskTable'.

public class DatabaseActivity extends SQLiteOpenHelper{


/*public DatabaseActivity(Context context, String name,
        CursorFactory factory, int version) {
    super(context, name, factory, version);
    // TODO Auto-generated constructor stub
}*/

static final String dbName="TaskDB";
static final String taskTable="TaskTable";
static final String colID="TaskID";
static final String colTask="TaskName";
static final String colStartDate="StartDate";
static final String colEndDate="EndDate";

static final String viewTasks="ViewTasks";  
static final String colDesi="Desi";



public DatabaseActivity(Context context) {
    super(context, dbName, null,66);

    // TODO Auto-generated constructor stub
}

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

    db.execSQL("CREATE TABLE "+taskTable+" ("+colID+" INTEGER PRIMARY KEY AUTOINCREMENT, "+
            colTask+" TEXT, "+colStartDate+" TEXT, "+colEndDate+" TEXT, "+colDesi+" TEXT)");



    db.execSQL("CREATE VIEW "+viewTasks+
            " AS SELECT "+taskTable+"."+colID+" AS _id,"+
            " "+taskTable+"."+colTask+","+

            " "+taskTable+"."+colStartDate+","+
            " "+taskTable+"."+colEndDate+","+

            " "+taskTable+"."+colDesi+","+
            " FROM "+taskTable+""
            ); 


}

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

    db.execSQL("DROP TABLE IF EXISTS "+taskTable);

    db.execSQL("DROP TRIGGER IF EXISTS dept_id_trigger");
    db.execSQL("DROP TRIGGER IF EXISTS dept_id_trigger22");
    //db.execSQL("DROP TRIGGER IF EXISTS fk_empdept_deptid");
    db.execSQL("DROP VIEW IF EXISTS "+viewTasks);
    onCreate(db);
}



 void AddTask(Task tsk)
{


    SQLiteDatabase db= this.getWritableDatabase();       

    ContentValues cv=new ContentValues();

    cv.put(colTask, tsk.getTask());

    cv.put(colStartDate, tsk.getStartDate());
    cv.put(colEndDate, tsk.getEndDate());

    cv.put(colDesi, tsk.getDesi());
    //cv.put(colDept,2);
    //////////////////consider here ezhil
    //

    db.insert(taskTable, colTask, cv);

    db.close();

}

 Cursor getAllTasks()
 {
    SQLiteDatabase db=this.getWritableDatabase();

    //Cursor cur= db.rawQuery("Select "+colID+" as _id , "+colName+", "+colDesi+", "+colStartDate+", "+colEndDate+" from "+TaskTable, new String [] {});
    Cursor cur= db.rawQuery("SELECT * FROM "+viewTasks,null);
    return cur;

 }


 public Cursor getTskByDept(String Tsk)
 {   
     SQLiteDatabase db=this.getReadableDatabase();
     String [] columns=new String[]{"_id",colTask,colDesi,colStartDate,colEndDate};
     Cursor c=db.query(viewTasks, columns, null, new String[]{Tsk}, null, null, null);
     return c;
 }   


 public int UpdateTsk(Task tsk)
 {
     SQLiteDatabase db=this.getWritableDatabase();
     ContentValues cv=new ContentValues();
     cv.put(colTask, tsk.getTask());
     cv.put(colDesi, tsk.getDesi());
     cv.put(colStartDate, tsk.getStartDate());
     cv.put(colEndDate, tsk.getEndDate());
     return db.update(taskTable, cv, colID+"=?", new String []{String.valueOf(tsk.getID())});

 }

 public void DeleteTsk(Task tsk)
 {
     SQLiteDatabase db=this.getWritableDatabase();
     db.delete(taskTable,colID+"=?", new String [] {String.valueOf(tsk.getID())});
     db.close();



 }


 }

Any one can help to me fri

thank you

  • 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-23T01:33:12+00:00Added an answer on May 23, 2026 at 1:33 am
    ... +colDesi+","+             // problem is with this ,
    " FROM "+taskTable+""
    

    You’ve got an extra , there. Remove the one before the FROM keyword.

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

Sidebar

Related Questions

I have implemented a simple Android application that I now would like to test
I tried searching here for a similar solution but didn't see one so I
I'm sure this one is easy but I've tried a ton of variations and
I am developing a simple android application using eclipse. I wrote a JUnit TestCase
I have a very simple application installer that needs to add an action to
I have a simple application that contains one button to be clicked in order
I am new to cocoa bindings so I tried to make a simple application
I have simple WebView code like this: WebView wv = (WebView) findViewById(R.id.webview1); wv.loadUrl(http://en.wikipedia.org/wiki/Book); But
I have a simple WPF application where I display one very large image (9000x2875)
Is there any python module to convert PDF files into text? I tried one

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.