How to display the rows and columns generated by SQL query in rdlc report dynamically?

vb.net , visual basic , sql server and vb.net Wichita, United States
  • 12 years ago
    How to display the rows and columns generated by SQL query in rdlc report dynamically. I first created the .rdlc file and then add tables and then Column Names to display. Now i dont want to design the .rdlc file and i wanted to fill the .rdlc file with the number of columns and rows returned by SQL Server. Can anyone give me idea how to do it? I am using the code like this as shown below. Dim strQry = "select CompanyName,Address,Address1,City,State,Zip,Teleph one,Email from Company" Dim reportPath = "MyReportApplication.reportCompany.rdlc" Dim sReportDataSource As ReportDataSource Connection() OpenConn() ds = New DataSet() dataAdapter = New SqlDataAdapter(strQry, conn) dataAdapter.Fill(ds, "TestDataBase") rdlcViewer.LocalReport.ReportEmbeddedResource = reportPath sReportDataSource = New ReportDataSource() sReportDataSource.Name = "TestDB_Company" sReportDataSource.Value = ds.Tables(0) rdlcViewer.LocalReport.DataSources.Add(sReportData Source) rdlcViewer.Dock = DockStyle.Fill CloseConn() Me.rdlcViewer.RefreshReport()

Post a reply

No one has replied yet! Why not be the first?

Sign in or Join us (it's free).

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“An expert is a man who has made all the mistakes that can be made in a very narrow field” - Niels Bohr