Discussion Forums  >  Uncategorized

Replies: 3    Views: 448

Vassan
Code is Art
Profile
Posts: 28
Reg: Apr 21, 2011
Chennai
280
05/09/11 06:34 AM (14 years ago)

DATA BASE files store in(LIb/Application Suuport/Iphone simu/IOS4.2/App/Doc)

Hi I'm sqlite3 in my app. When app run data are update in (LIb/Application Suuport/Iphone simu/IOS4.2/App/Doc) ther create new database and saved there pls give me solution pls pls. code is - (void)viewDidLoad { NSString *docsDir; NSArray *dirPaths; // Get the documents directory dirPaths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); docsDir = [dirPaths objectAtIndex:0]; // Build the path to the database file databasePath = [[NSString alloc] initWithString: [docsDir stringByAppendingPathComponent:@nameadd.sqlite]]; NSFileManager *filemgr = [NSFileManager defaultManager]; if ([filemgr fileExistsAtPath: databasePath ] == NO) { const char *dbpath = [databasePath UTF8String]; if (sqlite3_open(dbpath, &contactDB) == SQLITE_OK) { char *errMsg; const char *sql_stmt = CREATE TABLE IF NOT EXISTS add1 ( fname TEXT, addr TEXT, phon VARCHAR); if (sqlite3_exec(contactDB, sql_stmt, NULL, NULL, &errMsg) != SQLITE_OK) { status.text = @Failed to create table; } sqlite3_close(contactDB); } else { status.text = @Failed to open/create database; } } [filemgr release]; [super viewDidLoad]; }
 
David @ buzztouch
buzztouch Evangelist
Profile
Posts: 6866
Reg: Jan 01, 2010
Monterey, CA
78,840
like
05/09/11 10:15 PM (14 years ago)
What is your question.
 
Vassan
Code is Art
Profile
Posts: 28
Reg: Apr 21, 2011
Chennai
280
like
05/10/11 03:09 AM (14 years ago)
how to setpath for database file .bsu when i run app it create new database and store value in new database
 
David @ buzztouch
buzztouch Evangelist
Profile
Posts: 6866
Reg: Jan 01, 2010
Monterey, CA
78,840
like
05/10/11 09:47 AM (14 years ago)
Have no idea. If it's not a buzztouch related question I'm not the right person to ask. Maybe do a Google Search for SQL Lite iOS and see what you come up with?
 

Login + Screen Name Required to Post

pointerLogin to participate so you can start earning points. Once you're logged in (and have a screen name entered in your profile), you can subscribe to topics, follow users, and start learning how to make apps like the pros.