Click here to Skip to main content
15,905,682 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
In rdlc report viewer page I have written the following codes. The report viewer name is "rvInLineRejectionStyleWise".
I add one table in dataset. Now I need to add two tables in the dataset. Please help me. Advance thanks for helping me.
C#
DataTable dt = new DataTable();
rvInLineRejectionStyleWise.LocalReport.ReportPath = Server.MapPath("Smt_DefectWiseReport.rdlc");
SqlDataAdapter ad = new SqlDataAdapter("Smt_Defect_Wise_Report '" + strStyleCode + "'", cn);
DataSet ds = new DataSet();
ad.Fill(ds);
ReportDataSource rds1 = new ReportDataSource("DataSet1", ds.Tables[0]);
rvInLineRejectionStyleWise.LocalReport.DataSources.Clear();
rvInLineRejectionStyleWise.LocalReport.DataSources.Add(rds1);


I have write the code to add another dataset. It arise the error "An error occurred during local report processing."
C#
DataTable dtest = new DataTable();
                    rvInLineRejectionStyleWise.LocalReport.ReportPath = Server.MapPath("Smt_DefectWiseReport.rdlc");//Reports
                    SqlDataAdapter adtest = new SqlDataAdapter("Smt_Defect_Category_Wise_Graph '" + strStyleCode + "'", cn);
                    DataSet dstest = new DataSet();
                    adtest.Fill(dstest);
                    ReportDataSource rds2 = new ReportDataSource("DataSet2", ds.Tables["dtest"]);
                    rvInLineRejectionStyleWise.LocalReport.DataSources.Clear();
                    rvInLineRejectionStyleWise.LocalReport.DataSources.Add(rds2);

I provide my rest of the code :
C#
byte[] bytes = rvInLineRejectionStyleWise.LocalReport.Render("PDF", null, out mimeType, out encoding, out extension, out streamIds, out warnings);
               Response.Clear();
               Response.Buffer = true;
               Response.ContentType = "application/pdf";
               Response.BinaryWrite(bytes.ToArray());
               Response.End();
Posted
Updated 27-Feb-20 21:27pm
v6
Comments
syed shanu 30-Sep-14 1:46am    
Can you explain with detail ,Its not clear
Sumon562 30-Sep-14 1:49am    
Here I have to use another stored procedure and add this to the dataset.
Sumon562 30-Sep-14 6:33am    
I will be very grateful if get a solution.

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Configuration;
using System.Data.SqlClient;
using Microsoft.Reporting.WinForms;

namespace Tour_travel
{
public partial class Bill_Cash_Form : Form
{
public Bill_Cash_Form()
{
InitializeComponent();
}

private void Bill_Cash_Form_Load(object sender, EventArgs e)
{
tour_assi assi1 = GetData();
// TODO: This line of code loads data into the 'DataSet_Bill_cash.tour_assi' table. You can move, or remove it, as needed.
this.tour_assiTableAdapter.Fill(this.DataSet_Bill_cash.tour_assi);

this.reportViewer1.RefreshReport();
}

private tour_assi GetData()
{
string constr = @"Data Source=DESKTOP-U876ARO\SQLEXPRESS;Initial Catalog=Tour_rpt;User ID=sa;Password=neelu123";
using (SqlConnection con = new SqlConnection(constr))
{
using (SqlCommand cmd = new SqlCommand("SELECT TOP 20 * FROM tour_assi"))
{
using (SqlDataAdapter sda = new SqlDataAdapter())
{
cmd.Connection = con;
sda.SelectCommand = cmd;
using (DataSet_Bill_cash tour_assi = new DataSet_Bill_cash())
{
sda.Fill(tour_assi, "Textbox2");
return assi1;
}
}
}
}
throw new NotImplementedException();
}

internal tour_assi assi1 { get; set; }

private void Show_Click(object sender, EventArgs e)
{

}

private void textBox2_TextChanged(object sender, EventArgs e)
{

}

private void label1_Click(object sender, EventArgs e)
{

}
}
}
 
Share this answer
 
Comments
CHill60 28-Feb-20 3:49am    
An unexplained, unformatted code dump that has nothing to do with the question asked over 5 years ago is not a solution

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