Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: .NET3.0 C#4.0
Hi,
 
I have a button in my form .
When i click,Programatically ReportViewer should get generated,i have to bind a datasource to the report viewer and display a report to the enduser based on some constraints.
 
Please help me how to do this.
 
Thanks in Advance.
 
Regards
Chaithanya M
Posted 22-May-11 18:57pm
Edited 22-May-11 19:43pm
v3
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

Hope this[^] might help you.
  Permalink  
Comments
M.CHAITHANYA at 23-May-11 2:27am
   
Hi,
I have the following code :
 

SqlConnection cn =new SqlConnection(@"Data Source=ES-SYS-692\SQL2008;Integrated Security=SSPI;Database=mydb");
cn.Open();
DataSet ds=new DataSet();

SqlDataAdapter da=new SqlDataAdapter("select empno,ename,job from emp where sal>1250",cn);
da.Fill(ds,"empds");
 

ReportDataSource RDS=new ReportDataSource("empds",ds.Tables[0]);
 

ReportViewer RV = new ReportViewer();
RV.Visible = true;
 

RV.ProcessingMode=ProcessingMode.Local;
LocalReport lc=RV.LocalReport;
lc.DataSources.Add(RDS);
 
RV.LocalReport.Refresh();
 

This Code in a button click,when i click on the button..i ended up with nothing..unable to get the report(generate teh report).What has to be added to this code?
natia_21_alina_25 at 2-Feb-13 2:09am
   
it does not work :(
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

There is an article @ Dynamic Binding Of RDLC To ReportViewer[^] just for you.
  Permalink  
Comments
M.CHAITHANYA at 23-May-11 2:09am
   
I wanted to create a ReportViewer Dynamically and do all the later on stuff..dynamically only...in Windows Forms
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 3

  Permalink  
v2
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 4

I found the following webste after reading this post that helped me out.
 
http://www.gotreportviewer.com/[^]
 
It is dedicated to the reportviewer in Visual Studio.
 
Hogan
  Permalink  
Comments
Marcus Kramer at 23-Oct-12 12:26pm
   
Please don't add answers on old questions like this when answers already exist. Cheers.
snorkie at 23-Oct-12 13:47pm
   
How would you recommend that I add additional information then? I thought this link would be useful to others...
Marcus Kramer at 23-Oct-12 14:03pm
   
It's just that the question is really old. Your link is good which is why I just left the note and didn't remove it. What happens is that when an old question is "revived" so to speak back in to the active list, we usually end up with a whole bunch of crap being added to a question that is basically in archive mode already.
snorkie at 23-Oct-12 14:06pm
   
Fair enough.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 9,935
1 OriginalGriff 6,987
2 CPallini 5,845
3 George Jonsson 4,015
4 Gihan Liyanage 3,266


Advertise | Privacy | Mobile
Web01 | 2.8.140926.1 | Last Updated 23 Oct 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100