No Such Table error

前端 未结 3 1331
小鲜肉
小鲜肉 2020-12-06 10:12

I had to search for many posts regarding these errors, but still I cannot fix the problem. Here is my code, can anyone help me to see what is going wrong?

-          


        
相关标签:
3条回答
  • 2020-12-06 10:23

    There is no table Coffee in SQL.sqlite.

    SQLite silently creates the database file if it does not exist. So if you've got the path wrong, you are opening an empty database file, which of course does not contain any tables. Make sure the database file exists there and it is not empty.

    You can see what tables are there in the database by running SELECT * FROM sqlite_master; query.

    0 讨论(0)
  • 2020-12-06 10:31

    One thing my DBA tells me when I have database problems (Oracle in this case), is to try the query using the command line tools.

    This is how you would diagnose problems with sqlite3 and the iPhone simulator:

    1. Run the App in the iPhone Simulator so the database is created/copied in the Documents directory.
    2. Start Terminal
    3. cd ~/Library/Application Support/iPhone Simulator/<version>/Applications/<your-app-hash>/Documents. It's best to have just one App installed in the simulator so it's obvious what App is what.
    4. sqlite3 SQL.sqlite and try your query from there. You can also use the .schema command to see what the schema looks like.

    If the query works there and not in your App then you know you have a bug, else you have a sqlite query problem or broken schema.

    0 讨论(0)
  • 2020-12-06 10:35

    try reinstalling the app.the tables are created at the time of installing the app.sometimes it might happen because tables are not created

    0 讨论(0)
提交回复
热议问题