jeudi 3 mars 2016

Android - SQLite.SQLiteException: near ")" syntax error

I'm having a problem. Whenever I click the insert method that I made, that error is what I get.

// SQLite.SQLiteException: near ")" syntax error And it's located on the Sqlite class that I've installed.

if (r != Result.OK) {
            throw SQLiteException.New (r, GetErrmsg (db)); // this part where the error happens.
}

Here's my code for connection

public SQLiteConnection con = new SQLiteConnection(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Personal),"myDB.db3"));

My method code for inserting new record

var item = getcon.con.CreateTable<BALToDoTask>();

BELToDoTask beltodotask = new BELToDoTask();
beltodotask.TaskName = Task;

getcon.con.Insert(Task); // For inserting data

return "New task has been created...";

Lastly, here's my class

[Table("tbl_ToDoTask")]
public class BELToDoTask
{
    [PrimaryKey,AutoIncrement,Column("_id")]
    public int id { get; set; }

    [MaxLength(50)]
    public string TaskName { get; set; }
}

The activity and layout seems to be working because I can literally run my app. But when I click the button where the database sqlite interacts, it crashed and I get that error.

Thank you in advance!

Aucun commentaire:

Enregistrer un commentaire