Click here to Skip to main content
15,507,526 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
Hello Guys Help me

error is:
android.database.sqlite.SQLiteException: no such table: employees (code 1 SQLITE_ERROR): , while compiling: INSERT INTO employees
   (name, department, joiningdate, salary)
   (?, ?, ?, ?);

What I have tried:

My code:
private void createEmployeeTable() {
                "CREATE TABLE IF NOT EXISTS employees (\n" +
                        "    id int NOT NULL CONSTRAINT employees_pk PRIMARY KEY,\n" +
                        "    name varchar(200) NOT NULL,\n" +
                        "    department varchar(200) NOT NULL,\n" +
                        "    joiningdate datetime NOT NULL,\n" +
                        "    salary double NOT NULL\n" +
Updated 28-May-21 5:48am

1 solution


no such table: employees
You are trying to INSERT into a table which does not exist.

The code fragment you've shown is not the code which is generating the error.

Debug your code to find out why your createEmployeeTable method is not being called before you try to access the table.
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900