windowsforms-12005-controls-and-libraries-pivot-grid-getting-started-pivot-grid-walkthroughs-tutorial-1-bind-a-pivot-grid-to-an-mdb-database.md
The following tutorial explains how to add the Pivot Grid to a WinForms application and connect the control to the Northwind SQLite Database.
A DevExpress Subscription that includes the WinForms Pivot Grid Control: WinForms Subscription, DXperience Subscription, or Universal Subscription.
The Northwind database. You can find the database file in the source-code example or in the following path (the database ships with the DevExpress installation package):
Visual Studio. Version 2022 is used in this tutorial.
Run Microsoft Visual Studio and create a new Windows Forms App (.NET Framework) project.
Specify the project’s name and location in the New Project wizard.
Drag the PivotGridControl item from the DX.25.2: Data & Analytics toolbox group onto the form.
Open the Pivot Grid’s smart tag menu and click Dock in Parent Container to let the Pivot Grid fill the entire window’s client area.
Add the Northwind Database to the project. For example, create the “Data” folder in your project and place the nwind.db file in the folder.
In the Visual Studio menu, click Tools - NuGet Package Manager - Manage NuGet Packages for a Solution. In the invoked window, select the System.Data.SQLite package and click Install.
Click the Data Source Wizard panel.
In the invoked wizard, select SQL Data Connection and click New Data Source….
Click OK to create a new data source.
On the next page, select “No, I’d like to specify the connection parameters myself” to create a new data connection. Click Next.
Specify connection parameters. Choose SQLite as a data provider and specify a path to the Northwind database. Click Next to continue.
Click Next on the next page to save the connection string to the configuration file.
Click Run Query Builder… to invoke the Query Builder dialog.
Drag the SalesPerson table and drop it on the diagram pane. Select the following table fields to include them in the query:
Click OK. The resulting query is displayed in the wizard.
Click Finish to create the data source.
As a result, Visual Studio generates an SqlDataSource instance that supplies data from the Northwind database to the Pivot Grid control.
The sqlDataSource1 component is an SqlDataSource instance (a collection of tables, relationships, and constraints) that contains tables from the Northwind database.
The following help topic contains information about the functionality used in the tutorial: Bind to Data.
In the next tutorial, you create Pivot Grid fields, populate them with data, and configure the Pivot Grid layout.
Tutorial 2 - Populate Pivot Grid Fields with Data and Configure Layout