473,505 Members | 14,136 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

.net reportviewer

1 New Member
i am using reportviewer control. i want to change table name at runtime. i am using a stored prcedure with a parameter @tablename.

when i set the parameter as another thing code works. because i am designing the report, adding a table and assigning data columns. but when the tablename is variable i couldn't set the data columns. what should i do ?

this code works when parameter isn't tablename but when parameter is tablename setting object data source is problem

here is the code (show report button)

ReportViewer1.Visible = True

Dim MyConnection As New System.Data.SqlClient.SqlConnection()
MyConnection.ConnectionString = "Data Source=ssd-pc;Initial Catalog=kullanicilar;User ID=sa;Password=sapass"
MyConnection.Open()

Dim MyCommand11 As New SqlCommand()
MyCommand11.Connection = MyConnection
MyCommand11.CommandType = Data.CommandType.StoredProcedure
MyCommand11.CommandText = "deneme2"
Dim searchvalue As New SqlParameter("@raporadi", Data.SqlDbType.NVarChar, 1000)
searchvalue.Value = TextBox1.Text
MyCommand11.Parameters.Add(searchvalue)

Dim deneme As SqlDataAdapter = New SqlDataAdapter
deneme.TableMappings.Add("Table", TextBox1.Text)
deneme.SelectCommand = MyCommand11
Dim dataset1 As Data.DataSet = New Data.DataSet("dataset1")

deneme.Fill(dataset1)

Me.ReportViewer1.LocalReport.ReportPath = "report.rdlc"
Me.ReportViewer1.LocalReport.DataSources.Clear()

Me.ReportViewer1.LocalReport.DataSources.Add(New ReportDataSource("dataset2_deneme2", dataset1.Tables(0)))

Me.ReportViewer1.LocalReport.Refresh()
Sep 28 '07 #1
0 978

Sign in to post your reply or Sign up for a free account.

Similar topics

2
9758
by: Fabio Pagano | last post by:
I was wondering why is there so little interest on the reportviewer control and the report designer integrated in VS 2005. It seems very cool and i think it can replace Crystal Reports. Moreover,...
1
8512
by: Pieter | last post by:
Hi, In my application VB.NET 2005 application I placed a ReportViewer, and link it to a server-report: Me.ReportViewer1.ProcessingMode = Microsoft.Reporting.WinForms.ProcessingMode.Remote...
1
15842
by: steve | last post by:
Hi All I need help on how to manipulate the data returned from the database for displaying in the new reportviewer at runtime So far I have an rdlc file with a dataset, binding source and...
4
4461
by: Sevu | last post by:
I am working with ASP.NET.I am using ReportViwer Control to show my report.I like to add dropdownlist with in the reportviewer control. ( Not top to the control some thing like that).I need to...
1
17921
by: Rich | last post by:
Hello, I am trying to use the Reportviewer control. I have been following an example from the web, and the instructions from the help files on set up a ..rdlc and binding it to the reportviewer...
0
1998
by: Rich | last post by:
Hello, I started using the Reportviewer control (very nice) for generating Reporting Services type reports in my VB2005 app. I have been experimenting using a designer Reportviewer control from...
0
1674
by: Fred G. Sanford | last post by:
Firstly, I am a fairly new .Net developer, so please excuse any dumb/ignorant questions or comments. Thanks. I created a VWD Express project, which uses the ReportViewer control, on my local...
0
11580
by: billygotee | last post by:
Hi, I posted an issue previously that was entirely accurate. I have a master report called "MasterReport.rdlc" and a subreport called "Subreport.rdlc". MasterReport.rdlc has a single subreport...
10
3736
by: AG | last post by:
I am trying to use a ReportViewer control in a VS 2005 web application project (not Website project). When I try to create a new report (local), I can't seem to find any method to create a...
5
10323
by: =?Utf-8?B?Y2hlY2tyYWlzZXJAY29tbXVuaXR5Lm5vc3BhbQ== | last post by:
I have a VS 2008 ASP.NET webform that has a reportview tag on it, accessing an .RLDC report in local report. The columns for the report are essentially: Month Item #1 Item#2 Item#3 ...
0
7216
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7367
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7018
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
5613
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4699
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3187
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3176
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1528
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
407
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.