When i am trying to create 2 table in database only “sql_stmt” is working and “sql_stmt1” is not working in below code(but it showing that it is executed).
So only one table is creating but i want to create two table.
How can i create two table at a same in database.
const char *sql_stmt = "CREATE TABLE DOSAGE_HISTORY50(PILL_NAME VARCHAR(100),PILL_PER_DOSE NUMBER,PILLS_REMAINING NUMBER,SCHEDULE VARCHAR(100),DIRECTION VARCHAR(100))";
const char *sql_stmt1 = "CREATE TABLE DOCTOR (ID varchar(20))";
if (sqlite3_exec(pillDB, sql_stmt, NULL, NULL, &errMsg) != SQLITE_OK) {
}
if (sqlite3_exec(pillDB, sql_stmt1, NULL, NULL, &errMsg) != SQLITE_OK) {
}
You’re executing sql_stmt1 two times, trying to create table doctor. I think your first if statement should be: