Hi All,

I am developing an App for Windows Phone 8.1 called Transport Management System. First up am trying to use Sqlite DB with the App. I was successful in creating New DB, updating and retrieving values from DB. Now, i have tried to use existing Sqlite DB with the app for that i have used the code below. I added existing db in project, Changed Build Action --> content and Copy to Output Directory --> Copy Always in the properties of DB file.

private async Task CopyDatabase()
{
    bool isDatabaseExisting = false;
 
    try
    {
        StorageFile storageFile = await ApplicationData.Current.LocalFolder.GetFileAsync("people.db");
        isDatabaseExisting = true;
    }
    catch
    {
        isDatabaseExisting = false;
    }
 
    if (!isDatabaseExisting)
    {
        StorageFile databaseFile = await Package.Current.InstalledLocation.GetFileAsync("people.db");
        await databaseFile.CopyAsync(ApplicationData.Current.LocalFolder);
    }
}

But its not working.What could be the possible error?

Thanks,
Avi

Not working is rather bad description. If you post any error/crashes you gettng perhaps someone may help you...

commented: same feeling with you +0
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.