We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

Retrieval of data from database

Thread ID:

Created:

Updated:

Platform:

Replies:

116196 Apr 23,2014 05:01 AM May 2,2014 09:12 AM WinRT 1
loading
Tags: SfDataGrid
madhu
Asked On April 23, 2014 05:01 AM

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();





}


 


}





Ganesan V [Syncfusion]
Replied On May 2, 2014 09:12 AM

Hi Madhu,

Thank you for using Syncfusion Products.

We have created a sample to achieve your requirement to retrieve data from database and setting this data to the ItemSource of grid.

You can find the sample under the following location:

Please let us know if this solution helps you.

Thanks,

Ganesan V


Attachment: RetriveDataUsingSQLite_a5ecf4de.zip

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;