I have created the RDLC report with one page, and it shows like that in the Report Viewer too:
But whenever I select to save as a PDF, it duplicates that page:
I have tried changing the size, removing all variables, but nothing seems to work.
Here is the code used to generate the report:
using Microsoft.Reporting.WinForms;
using System.Data;
using System.Data.SqlClient;
namespace MediniApp
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
SqlConnection con = new SqlConnection(@";");
private void button1_Click(object sender, EventArgs e)
{
con.Open();
SqlCommand command = new SqlCommand("select * from Owner",con);
SqlDataAdapter adapter = new SqlDataAdapter(command);
DataTable dt = new DataTable();
adapter.Fill(dt);
reportViewer1.LocalReport.DataSources.Clear();
ReportDataSource source = new ReportDataSource("Owner",dt);
reportViewer1.LocalReport.ReportPath = @"C:Report1.rdlc";
reportViewer1.LocalReport.DataSources.Add(source);
reportViewer1.RefreshReport();
}
private void Form1_Load(object sender, EventArgs e)
{
}
}
}
New contributor
Anish Koundinya is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
1