Archive

Archive for the ‘SSRS’ Category

A new milestone 125th post on Indiandotnet.wordpress.com so far so good

December 24, 2011 Leave a comment

Dear Friends,
This post is different post from my regular technical articles and it is my 125th post on Indiandotnet.wordpress.com.

I would like to thank all of my friends, family members, colleges & most valuable the reader of this blog who continuously giving feedback and improving my skill also.
So thank you very very much.
Keep reading, Keep commenting, and keep giving feedback.
I need more improvement and I know you people will help me in sharing my thoughts.
God bless you all.


Happy Holidays.


Merry Christmas.
Thanks
Rajat Jaiswal

Call SQL Server Reporting Services by asp.net in 5 easy step

January 3, 2011 1 comment
Hello friends,

Wish you Happy New Year.

Today I am going to share a simple way to use SQL Server Reporting Services locally. I am trying to share simple steps for creating report.

I am using North wind database and try to create a sample report which shows customer information.

Here we go

Step 1:- Create a project in my case I am using web project you can choose either web/window. In the project add a type dataset and drag drop customers table on XSD. (You can customize schema according to your need) as shown in below fig.

Step2:- Now add a report (.RDLC)  

Step 3:-  When you add  report then on right side a screen(Just like solution explore) will appear with name “ Web Site Data source “  in this you will find  the type dataset which we have added and  when you expand the  type dataset object you will find all the table schema as show in fig. 

 
Step 4: Now just drag drop a table from toolbars’ report item. And drag drop column from data source (type data set which shown in step3) to table column which you need to show in report. 
 

Step 5:- Once you done with step4 now next step to call report from “Asp.net”. For this just drag drop Microsoft reporting viewer and do following code.

Below is the code

Dim sqlcon As New SqlConnection(ConfigurationManager.ConnectionStrings(“connectionString”).ConnectionString.ToString())

            sqlcon.Open()

            Dim sqlcmd As New SqlCommand

            sqlcmd.CommandText = “SELECT * FROM Customers”

            sqlcmd.CommandType = CommandType.Text

            sqlcmd.Connection = sqlcon

            Dim sda As New SqlDataAdapter

            Dim ds As New myDs

            sda.SelectCommand = sqlcmd

            sda.Fill(ds, ds.Customers.TableName)

‘clearing report viewer

            Me.ReportViewer1.LocalReport.DataSources.Clear()

‘Create datasource for report

            Dim rds As New ReportDataSource()

            rds.Name = “myDs_Customers”

            rds.Value = ds.Customers

            Me.ReportViewer1.LocalReport.DataSources.Add(rds)

‘assigning report path.

            Me.ReportViewer1.LocalReport.ReportPath = “myReport.rdlc”

            Me.ReportViewer1.LocalReport.Refresh()

 Now run the page and you will get report .

SSRS 
so enjoy.

Thanks

Rajat Jaiswal 

Follow

Get every new post delivered to your Inbox.

Join 38 other followers