views:

48

answers:

2

I am trying to learn Monotouch and have an SQLite db with information. Using the examples here I can open, fill and query the database (which is set as "Content" in my project), but when I rerun the program, no data exists in the database again.

I am guessing that somehow I have to save the database file to the Documents directory after changing it, but I can't quite figure out how to do that. Do I have to open the file with File.Open, then open another one in Documents and write to that one line by line? That doesn't seem efficient or correct.

Does anyone have any examples of this?

A: 

What is the "Copy to Output Directory" set to for you db file? I'd guess the most likely problem is that every time you build in the IDE, the blank db is overwriting the modified db from your last session.

Jason
I have tried both "Copy to Output Directory" and not, neither works.What's really odd is that if I open the file in my Solution directory in an SQLite database program (Mike T's SQLite Database App) it has a fully populated table. When I open the one in my BIN of my Solution it is also populated. When I open the one in the Application directory under Application Support, it has no tables or data in it at all.
Pselus
Ok, figured out part of the problem. When I was trying to open the file to see if it existed in the Documents directory, it was creating a blank file. If I look in my root path (BIN folder) it works fine. However, that doesn't seem like the right way to do it. When the app gets installed to an iPhone I have a feeling that it's not going to be able to look in the root folder every time, or is it?
Pselus