Articles in this section

How to import MS Access Database to the SfDataGrid?

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.

C#

            //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();
            conn.Open();
            myDataAdapter.Fill(ds, "Employee");
            conn.Close();
            //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:

WPF: http://www.syncfusion.com/downloads/support/directtrac/139270/ze/WPF-1978728792

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Access denied
Access denied