protected override void OnActivityResult(int requestCode, Result resultCode, Android.Content.Intent data) { if (resultCode == Result.Canceled) { return; } data.GetMediaFileExtraAsync(this).ContinueWith(t => { var r = t.Result.Path; try { sqliteFilename = "myDb.db3"; string documentsPath = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal); // Documents folder path = Path.Combine(documentsPath, sqliteFilename); var platform = new SQLite.Net.Platform.XamarinAndroid.SQLitePlatformAndroidN(); var param = new SQLiteConnectionString(path, false); var connection = new SQLiteConnection(platform, path); connection.CreateTable <AttendIn>(); AttendIn i = new AttendIn(); i.EmployeeID = EmployeeIDValue; i.Petsa = System.DateTime.Now; connection.Insert(i); Toast.MakeText(this, "Record Added Successfully...,", ToastLength.Short); } catch (Exception ex) { Toast.MakeText(this, ex.ToString(), ToastLength.Short).Show(); } //Save to sqlLie }, TaskScheduler.FromCurrentSynchronizationContext()); }
public void CreateDB() { string sqliteFilename = "myDb.db3"; string documentsPath = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal); // Documents folder string path = Path.Combine(documentsPath, sqliteFilename); var platform = new SQLite.Net.Platform.XamarinAndroid.SQLitePlatformAndroidN(); var param = new SQLiteConnectionString(path, false); var connection = new SQLiteConnection(platform, path); }
/// <summary> /// Gets the connection of the database. /// </summary> /// <param name="db">The database.</param> /// <returns></returns> public SQL.SQLiteConnection GetConnection(string db) { var sqliteFilename = "ACD_" + db + ".db3"; string documentsPath = Environment.GetFolderPath(Environment.SpecialFolder.Personal); // Documents folder var path = Path.Combine(documentsPath, sqliteFilename); // Create the connection var plat = new SQL.Platform.XamarinAndroid.SQLitePlatformAndroidN(); var conn = new SQL.SQLiteConnection(plat, path, false); // Return the database connection return(conn); }
private void DisplayData() { string documentsPath = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal); // Documents folder path = Path.Combine(documentsPath, sqliteFilename); var platform = new SQLite.Net.Platform.XamarinAndroid.SQLitePlatformAndroidN(); var param = new SQLiteConnectionString(path, false); var connection = new SQLiteConnection(platform, path); var data = connection.Table <AttendIn>(); //ArrayAdapter<AttendIn> adapter = new ArrayAdapter<AttendIn>(this, Android.Resource.Layout.SimpleListItem2, data.ToList()); //lv.Adapter = adapter; //var x = test; }
public void CreateDB() { var output = ""; sqliteFilename = "myDb.db3"; string documentsPath = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal); // Documents folder path = Path.Combine(documentsPath, sqliteFilename); var platform = new SQLite.Net.Platform.XamarinAndroid.SQLitePlatformAndroidN(); var param = new SQLiteConnectionString(path, false); output += "Creating Databse if it doesnt exists"; var connection = new SQLiteConnection(platform, path); output += "\n Database Created...."; Toast.MakeText(this, output, ToastLength.Short).Show(); }
public SQLite.Net.SQLiteConnection GetConnection() { var sqliteFilename = "pokedex.db3"; string documentsPath = System.Environment.GetFolderPath(Environment.SpecialFolder.Personal); // Documents folder var path = Path.Combine(documentsPath, sqliteFilename); Console.WriteLine(path); if (!File.Exists(path)) { File.Create(path); } var plat = new SQLite.Net.Platform.XamarinAndroid.SQLitePlatformAndroidN(); var conn = new SQLite.Net.SQLiteConnection(plat, path); // Return the database connection return(conn); }
public SQLiteAsyncConnection GetConnectionAsync() { var dbFileName = "RailServeDb.db3"; string documentPath = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal); //string libraryPath = Path.Combine(documentPath, "..", "Library"); var path = Path.Combine(documentPath, dbFileName); if (!File.Exists(path)) { File.Create(path); } var platform = new SQLite.Net.Platform.XamarinAndroid.SQLitePlatformAndroidN(); var param = new SQLiteConnectionString(path, false); // return db connection var connection = new SQLiteAsyncConnection(() => new SQLiteConnectionWithLock(platform, param)); return(connection); }