Create Reports from SQL Server Databases with List & Label

Create reports based on your existing SQL databases with List & Label. Easy to bind, support of relational databases, Report Designer included. See how it works.

How to Create Reports with List & Label Using Data from SQL Server Databases

List & Label can easily be bound to SQL server data. This allows the creation of comprehensive reports based on your existing SQL databases like viewes, tables and stored procedures. Relational databases are also supported out of the box, enabling you to drill down or drill through your data. A complete walkthrough is available in the following video (3 min).

Generate Reports from SQL Database

Samples for Binding SQL Databases to List & Label

More technically, the classes involved are the SqlConnectionDataProvider to get the whole database or the DbCommandSetDataProvider to execute individual SQL commands as needed. A simple sample would be…

// Part 1: Prepare connection information for the Microsoft SQL database
SqlConnectionStringBuilder sqlConnectionString = new SqlConnectionStringBuilder();
sqlConnectionString.DataSource = Properties.Resources.SQLServerInstanceName;
sqlConnectionString.UserID = Properties.Resources.SQLServerUsername;
sqlConnectionString.Password = Properties.Resources.SQLServerPassword;
sqlConnectionString.InitialCatalog = "Northwind";

// Part 2: Connect the SQL connection to the matching
// List & Label data provider for SQL connections
SqlConnection sqlConnection = new SqlConnection(sqlConnectionString.ConnectionString);
SqlConnectionDataProvider sqlDataProvider = new SqlConnectionDataProvider(sqlConnection);

// Part 3: Create the List & Label object and attach the SQL data provider
// and call the designer
using(ListLabel LL = new ListLabel())
{
	LL.DataSource = sqlDataProvider;
	LL.Design();
}

… which opens the Designer automatically filled with the data from the database given in the connection string. From here, you can then proceed with one of our Designer tutorials.

Tip: The article Using the DbCommandSetDataProvider With Stored Procedures shows how easy it is to access stored procedures in an SQL database and use them as data sources for reports.

More about SQL Reporting and List & Label

Also see the .NET Tutorial for even more valuable information on using List & Label.

It doesn’t matter if you have a classic Windows desktop application or a modern web application with ASP.NET - the List & Label data providers can be used in both worlds.

Please leave a reply to this post if you’ve got questions about how to create reports with List & Label based on data from SQL databases or if you miss any information about this topic.

If you already enjoy connecting SQL databases as datasource to List & Label for creating amazing reports, feel free to show your love with a like below.