# Step 2: Configuring FlexPivotPage Control and DataEngine

This topic covers information about connecting with DataEngine.

## Content

In the previous step, you created a basic Windows Forms application and added FlexPivotPage control to it. In this step, you begin with configuring the FlexPivotPage control and [C1DataEngine](/componentone/api/win/online-flexpivot/dotnet-standard-api/C1.DataEngine/Assembly) and connecting them to data.

To configure the FlexPivotPage control and C1DataEngine and connect them with data, perform the following steps.

1. Switch to the code view i.e. Form1.cs and initialize workspace within the form's constructor. 

    ```vbnet
    flexPivotPage.FlexPivotPanel.Workspace.Init(path)
    ```

    ```csharp
    flexPivotPage.FlexPivotPanel.Workspace.Init(path);
    ```
2. Initialize full path to the folder where the DataEngine stores data in files, and an SQL connection above the Form's constructor using the following code.

    ```vbnet
    Dim path As String = Environment.GetFolderPath(Environment.SpecialFolder.Personal) & "\ComponentOne Samples\Common"
    Dim conn As OleDbConnection = New OleDbConnection()
    ```

    ```csharp
    string path = Environment.GetFolderPath(Environment.SpecialFolder.Personal) + @"\ComponentOne Samples\Common";
    OleDbConnection conn = new OleDbConnection();             
    ```

    Initially, the DataEngine is empty but it automatically fills with files as and when the data is added to it.
3. Initialize a standard connection string to the database file being used.

    ```vbnet
    Private Function GetConnectionString() As String
        Dim path As String = Environment.GetFolderPath(Environment.SpecialFolder.Personal) & "\ComponentOne Samples\Common"
        Dim conn As String = "provider=Microsoft.ACE.OLEDB.12.0;data source={0}\c1nwind.mdb;"
        Return String.Format(conn, path)
    End Function
    ```

    ```csharp
    static string GetConnectionString()
    {
        string path = Environment.GetFolderPath(Environment.SpecialFolder.Personal) + @"\ComponentOne Samples\Common";
        string conn = @"provider=Microsoft.ACE.OLEDB.12.0;data source={0}\c1nwind.mdb;";
        return string.Format(conn, path);
    }
    ```
4. Switch to the Design view and subscribe **Form1\_Load** event from the **Properties** window.
5. Add the following code to the event handler created for **Form1\_Load** event in the code view. 

    ```vbnet
    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        conn.ConnectionString = GetConnectionString()
        conn.Open()
        Dim command = New OleDbCommand("Select * from Invoices", conn)
        Dim connector = New C1.DataEngine.DbConnector(flexPivotPage.FlexPivotPanel.Workspace, conn, command)
        connector.GetData("invoices")
        flexPivotPage.FlexPivotPanel.ConnectDataEngine("Invoices")
    End Sub
    ```

    ```csharp
    private void Form1_Load(object sender, EventArgs e)
    {
        conn.ConnectionString = GetConnectionString();
        conn.Open();        
        var command = new OleDbCommand("Select * from invoices", conn);
        var connector = new C1.DataEngine.DbConnector(flexPivotPage.FlexPivotPanel.Workspace, conn, command);
        connector.GetData("invoices");
        flexPivotPage.FlexPivotPanel.ConnectDataEngine("invoices");
    }
    ```

With this, you have successfully connected the FlexPivotPage control and DataEngine to data.

>type=note
> Note: WinForms .NET Edition does not include rich design-time support yet. We will enhance it in future releases.