Click here to Skip to main content
15,919,931 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Help Please: I am using visual studio 2010 and crystal report XI. I have created a .rpt report which contains my data. I need to display this report using reportviewer. I tried a lot but didn't find any solution. Upto now where I am is as following:

string constr = "Data Source=BITS;Initial Catalog=TEST_DB;User ID=sa;Password=123456";
SqlConnection sqlcon = new SqlConnection(constr);
string query;
query = "SELECT * FROM t_Student";
sqlcon.Open();
SqlDataAdapter da = new SqlDataAdapter(query, constr);
DataSet ds = new DataSet();
da.Fill(ds, "t_Student");
Microsoft.Reporting.WinForms.ReportDataSource reportDataSource = new Microsoft.Reporting.WinForms.ReportDataSource();
reportDataSource.Name = "StudentListView";
reportDataSource.Value = "StudentListView.rpt";
reportViewer1.LocalReport.DataSources.Add(new Microsoft.Reporting.WinForms.ReportDataSource("ds_t_Student", ds.Tables[0]));
reportViewer1.LocalReport.DataSources.Add(reportDataSource);
reportViewer1.LocalReport.ReportPath = "StudentListView.rpt";
sqlcon.Close();


************************************
Please reply me as soon as you can.
***************

Thanks
Posted
Updated 14-Sep-10 0:15am
v2
Comments
Sandeep Mewara 14-Sep-10 12:46pm    
What's the issue? You tried but failed in what? Which part is stopping you?

1 solution

Hi,

You can refer this links for further

http://csharpdotnetfreak.blogspot.com/2009/07/crystal-reports-in-winforms-parameter.html


http://aspalliance.com/1297_Displaying_Crystal_Reports_using_WinForms_and_C.all

Thanks & Regards,
Jeevan
 
Share this answer
 
Comments
bond_cse05 17-Sep-10 7:05am    
Thanx for your first and quick response.

I read both articles as mentioned by you. but both works in visual studio 2005 but i need crystal report for visual studio 2010. In visual studio there is no crystalreportviewer as in vs2005 what here is just reportviewer.

Please reply me for this problem.

thanks again.

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900