Possible Duplicate:
How to share all the data i have stored using sqlite database between two devices to reuse the data by dumping in another device
I want to import a sqlite Database and save it as a CSV file and then mail this file via email.
can i import sqlite in to csv format in iphone app programmatically to attach in mail composer
i used following functio to get the data base file
+(NSString*)getSqliteDBFile
{
NSString *docsDirectoryPath;
NSArray *dirPaths;
NSString *databasePath;
NSFileManager *fileManager = [NSFileManager defaultManager];
// Get the documents directory
dirPaths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
docsDirectoryPath = [dirPaths objectAtIndex:0];
NSLog(@"path :%@", docsDirectoryPath);
// Build the path to the database file
databasePath = [[NSString alloc] initWithString: [docsDirectoryPath stringByAppendingPathComponent: @"LeadGenDB.sqlite"]];
NSLog(@"path :%@", databasePath);
return databasePath;
}
Now I nees to convert sqlite file to csv file
you can not convert direct sqlite to csv. First you get your all database data and write into csv file.use below example for create csv and send it.