Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 75885

SQLiteConnection doen't work. Just wonder why?

$
0
0

I'm trying to run my app with SQLite DataBase.
Data base was created before using the SqliteBrowser.
Just wondering what could it be?

database = new SQLiteConnection(DatabasePath);

This is where it crashes.

    > string DatabasePath {
      get { 
          var sqliteFilename = "KDLife_mobileDB.db3";
          #if __IOS__
          string documentsPath = Environment.GetFolderPath (Environment.SpecialFolder.Personal); // Documents folder
          string libraryPath = Path.Combine (documentsPath, "..", "Library"); // Library folder
          var path = Path.Combine(libraryPath, sqliteFilename);
          #else
          #if __ANDROID__
          string documentsPath = Environment.GetFolderPath (Environment.SpecialFolder.Personal); // Documents folder
          var path = Path.Combine(documentsPath, sqliteFilename);
          #else
          // WinPhone
          var path = Path.Combine(Windows.Storage.ApplicationData.Current.LocalFolder.Path, sqliteFilename);;
          #endif
          #endif
          return path;
      }
  }

This is how i'm trying to get DataBase path.

I'm using sqlite-new and sqlite-net-wp8 NugetPackages.
I use shared project and looks like there is no detailed or any tutorial how to deploy SQLite database to Xamarin.Forms project.


Viewing all articles
Browse latest Browse all 75885

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>