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 21: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)

  Print Answers RSS
0 OriginalGriff 587
1 Sergey Alexandrovich Kryukov 479
2 Maciej Los 305
3 BillWoodruff 220
4 Mathew Soji 195
0 OriginalGriff 7,356
1 Sergey Alexandrovich Kryukov 6,817
2 DamithSL 5,461
3 Manas Bhardwaj 4,946
4 Maciej Los 4,475


Advertise | Privacy | Mobile
Web04 | 2.8.1411023.1 | 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