Skip to content Skip to sidebar Skip to footer

No Such Table .. Could Not Execute The Query... Xcode Sqlite

I am using code from sqlite database iOS app tutorial, but it is giving sql error when inserting a record: 2014-12-15 12:08:08.458 SQLite3DBSample[2677:60b] no such table: peopleIn

Solution 1:

Actually your query is executing without any issues. Your message comes wrong due to the following code:

BOOLexecuteQueryResults= sqlite3_step(compiledStatement);
 if (executeQueryResults == SQLITE_DONE)
 {
    ...
 }

Change that to:

 if (sqlite3_step(compiledStatement) == SQLITE_DONE)
 {
    ...
 }

SQLITE_DONE is a macro, defined with with value 101, you are trying to compare that with a BOOL, so the condition is failing each time.

Solution 2:

load your table in viewdidAppear like that

-(void)viewDidAppear:(BOOL)animated{
[super viewDidAppear:YES];
[self loadData]; }

Solution 3:

This issue can be solved by "reseting content and setting" of simulator but please make sure your code is correct and table really exists in database first. You can use "sqlite browser" to check database and its tables. You can download "sqlite browser" from this link -> http://sqlitebrowser.org/

For more information, please refer this link -> sqlite prepare statement error - no such table

enter image description here

Post a Comment for "No Such Table .. Could Not Execute The Query... Xcode Sqlite"