New to Telerik UI for WinFormsStart a free 30-day trial

Binding to DataReader

Updated over 6 months ago

To extract values from a data source using a DataReader, use the GridViewTemplate LoadFrom() method to consume an object instance that supports IDataReader. The code sample below uses a OleDbDataReader reading an Access data source:

C#
OleDbConnection conn = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=..\\..\\DataSources\\Nwind.mdb");
conn.Open();
OleDbCommand cmd = new OleDbCommand("Select TOP 5 * FROM Customers", conn);
OleDbDataReader reader = cmd.ExecuteReader();
radGridView1.MasterTemplate.LoadFrom(reader);

See Also

In this article
See Also
Not finding the help you need?
Contact Support