Articles in this section
Category / Section

How to import MS Access Database to the SfDataGrid?

1 min read

In the SfDataGrid, you can connect the MS Access Database through the OleDbConnection and set the Data table as a DataGrid’s ItemSource by using the DataSet as follows.


            //Creates a new OleDB connection.
            System.Data.OleDb.OleDbConnection conn = new System.Data.OleDb.OleDbConnection(@"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=EmployeeDatabase.accdb; Persist Security Info=True");
            //Passes the Select statement and connection information to the initialization constructor for the OleDBDataAdapter.
            System.Data.OleDb.OleDbDataAdapter myDataAdapter = new System.Data.OleDb.OleDbDataAdapter("SELECT * FROM Employee", conn);
            //Creates a DataSet.
            DataSet ds = new DataSet();
            myDataAdapter.Fill(ds, "Employee");
            //Sets the ItemSource.
            datagrid.ItemsSource = ds.Tables["Employee"];


Note: You can create a Database in the MSAccess and save it in the following example location.

Sample Link:


Did you find this information helpful?
Help us improve this page
Please provide feedback or comments
Comments (0)
Please sign in to leave a comment