Skip to content

Latest commit

 

History

History
58 lines (43 loc) · 3.51 KB

File metadata and controls

58 lines (43 loc) · 3.51 KB

WinForms Data Grid - Bind to Azure SQL data

This example fetches data from the Azure SQL Database and displays it in the GridControl.

Note

To bind any dataset to a data-aware control, the dataset must implement the IList or IListSource interface. Read the following help topic for additional information: Data Binding.

This example contains sample AdventureWorksLT data. To generate a sample database identical to the one used in this example, follow the Quickstart: Create a single database in Azure SQL Database using the Azure portal, PowerShell, and Azure CLI Microsoft article.

Ribbon UI commands allow you to bind to a sample Azure database using one of the following methods:

  • Direct binding to a standard DataTable object
  • Binding with a DevExpress SqlDataSource component
  • Binding with an Entity Framework model

WinForms Application

Do the following to run this example:

  • Create a server-level firewall rule for your database

  • Specify connection settings in the Main method:

    static class Program {
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        [STAThread]
        static void Main() {
            ConnectionSettings.SetUp("your_server_name.database.windows.net", "your_login", "your_password", "your_database_name");
            ConnectionSettings.SelectQuery = "SELECT * FROM SalesLT.Product";
            EFDataProvider.PreInitContext();
    
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new Main());
        }
    }

Documentation

Does this example address your development requirements/objectives?

(you will be redirected to DevExpress.com to submit your response)