Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C#4.0
Hi friends
I want to fill dataReportViewer with DataTable but i don't know how can i do this.
Could you help me?
Posted 2-Feb-13 20:09pm

1 solution

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

Solution 1

  Permalink  
Comments
Elham.Deljooei at 3-Feb-13 2:41am
   
this my code:
 
SqlDataAdapter adp = new SqlDataAdapter("Report",con);
adp.SelectCommand = new SqlCommand();
adp.SelectCommand.CommandType = CommandType.StoredProcedure;
DataTable dtbl=new DataTable();
dtbl.TableName="DataTable1";
 
adp.SelectCommand.Parameters.AddWithValue("@clrk_Name", txtNameReport.Text);
adp.SelectCommand.Parameters.AddWithValue("@clrk_Family",txtFamilyReport.Text);
adp.SelectCommand.Parameters.AddWithValue("@clrk_MelliCode",txtMelliCodeReport.Text);
adp.SelectCommand.Parameters.AddWithValue("@AzTarikh",txtMelliCodeReport.Text);
adp.SelectCommand.Parameters.AddWithValue("@Ela", txtElaReport.Text);
adp.Fill(dtbl);
ReportDataSource source = new ReportDataSource("DataTable1",dtbl);
reportViewer1.LocalReport.DataSources.Add(source);
when i run my project, i get this eeror
 
Error 1 The tablix ‘Tablix2’ is in the report body but the report has no dataset. Data regions are not allowed in reports without datasets. D:\Project\evaluation\WindowsFormsApplication1\WindowsFormsApplication1\Report1.rdlc WindowsFormsApplication1
Krunal Rohit at 3-Feb-13 2:46am
   
SqlDataAdapter adp = new SqlDataAdapter("Report",con);
adp.SelectCommand = new SqlCommand();
adp.SelectCommand.CommandType = CommandType.StoredProcedure;
DataSet ds = new DataSet();
DataTable dt = new DataTable("DataTable");
adp.Fill(ds, "DataTable");
Elham.Deljooei at 3-Feb-13 2:57am
   
i did it but i get it error :-(
Elham.Deljooei at 3-Feb-13 4:37am
   
could you help me?

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



Advertise | Privacy | Mobile
Web01 | 2.8.141022.2 | Last Updated 3 Feb 2013
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