Hi,
I need to populate the grid with the data in the database. Since the grid is bound to a item source I am unable to perform a proper retrieval.
Following is the code that I Tried:
"mat.cs" is the file which is bound to the grid.
try
{
var dbpath = Path.Combine(Windows.Storage.ApplicationData.Current.LocalFolder.Path, "Test2.db");
using (var db = new SQLite.SQLiteConnection(dbpath))
{
foreach (ExpandoObject ep in (this.DataContext as mat).DynamicOrder)
{
//db = new SQLite.SQLiteConnection(dbpath);
dynamic epObj = ep;
var line = string.Empty;
if (!string.IsNullOrEmpty(epObj.Name))
line = epObj.Name;
Material conobj = new Material();
conobj.Name = epObj.Name;
conobj.Type = epObj.Type;
conobj.Quantity = epObj.Quantity;
List<Material> lstMats = db.Table<Material>().ToList();
}
db.Commit();
db.Dispose();
db.Close();
//var bline = new MessageDialog("Data Inserted");
//await bline.ShowAsync();
}
}