Microsoft SQL Azure is a relational database service that allows you to host your SQL Server based database in the cloud. Since cloud computing is gaining a lot of popularity recently, we decided to demonstrate how to connect and consume an existing SQL Azure database with Telerik Reporting. There are three basic methods for connecting Telerik Reporting to a SQL Azure database:
In this blog post we will cover how to connect Telerik Reporting to SQL Azure via ADO.NET. The other two methods will be discussed in subsequent blog posts of the same series.
For the sake of this example we assume an existing SQL Azure account with the AdventureWorks sample database already installed. Let’s start a new report and use the SqlDataSource component as a data source. To connect to the SQL Azure database specify the server name and the login credentials of your SQL Azure account in the connection dialog, then choose the AdventureWorksLTAZ2008R2 sample database as shown below:
Now let’s define a simple SQL query that allows us to search for products by category and model:
Product.ProductCategoryID = Category.ProductCategoryID
Product.ProductModelID = Model.ProductModelID
The SqlDataSource component can execute the above SQL query automatically against the SQL Azure database passing the required parameters when necessary.
Attached to this blog post you can find a complete sample project including a report that demonstrates the discussed technique. In order to run the sample web application you need to modify the connection string in the web.config file with your existing SQL Azure server name and login credentials.
As you can see, connecting Telerik Reporting to SQL Azure using ADO.NET is very simple and straightforward with the powerful SqlDataSource component and requires no extra code from you.
The video below demonstrates how to create the sample report yourself in few quick steps:
The video is also available on Telerik TV: Connecting Telerik Reporting to SQL Azure via ADO.NET.
Stefan’s main interests outside the .NET domain include rock music, playing the guitar and swimming.