Mirage_sk
November 26th, 2008, 07:07 AM
Hi All!
I'm a bit new in developing.
I have made data application(windows app with integrated reporting), all components written manually(without any wizard). with Ado.net.classes. need to make report with the same way
I make form for report viewer see code bellow:
and make a report file receipt.rdlc
but I can not see any record at report.
I can not link report.rdlc file with dataset programmicaly.
can anyone help me, what is wrong and show correct code?
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;
using Microsoft.Reporting;
using Microsoft.Reporting.WinForms;
namespace ado.net
{
public partial class Receipt : Form
{
string connectionString = MDIParent.conectionText;
string procedureString = "dbo.receiptPrint";
public Receipt()
{
InitializeComponent();
}
private void Receipt_Load(object sender, EventArgs e)
{
//this.reportViewer1.RefreshReport();
SqlConnection connect = new SqlConnection(connectionString);
SqlCommand printCommand = connect.CreateCommand();
printCommand.CommandText = procedureString;
printCommand.CommandType = CommandType.StoredProcedure;
connect.Open();
printCommand.ExecuteNonQuery();
connect.Close();
DataSet printDataSet = new DataSet();
SqlDataAdapter printDataAdapter = new SqlDataAdapter();
printDataAdapter.SelectCommand = printCommand;
printDataAdapter.Fill(printDataSet,"receiptPrint");
DataTable dt = printDataSet.Tables[0];
LocalReport rep = reportViewer1.LocalReport;
this.reportViewer1.LocalReport.ReportEmbeddedResource = "ado.net.receipt.rdlc";
ReportDataSource prtRcpt = new ReportDataSource("printDataset_vw_reception_first(CU02)", printDataSet.Tables["vw_reception"]);
reportViewer1.LocalReport.DataSources.Clear();
reportViewer1.LocalReport.DataSources.Add(prtRcpt);
this.reportViewer1.RefreshReport();
}
}
}
Reply With Quote
I'm a bit new in developing.
I have made data application(windows app with integrated reporting), all components written manually(without any wizard). with Ado.net.classes. need to make report with the same way
I make form for report viewer see code bellow:
and make a report file receipt.rdlc
but I can not see any record at report.
I can not link report.rdlc file with dataset programmicaly.
can anyone help me, what is wrong and show correct code?
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;
using Microsoft.Reporting;
using Microsoft.Reporting.WinForms;
namespace ado.net
{
public partial class Receipt : Form
{
string connectionString = MDIParent.conectionText;
string procedureString = "dbo.receiptPrint";
public Receipt()
{
InitializeComponent();
}
private void Receipt_Load(object sender, EventArgs e)
{
//this.reportViewer1.RefreshReport();
SqlConnection connect = new SqlConnection(connectionString);
SqlCommand printCommand = connect.CreateCommand();
printCommand.CommandText = procedureString;
printCommand.CommandType = CommandType.StoredProcedure;
connect.Open();
printCommand.ExecuteNonQuery();
connect.Close();
DataSet printDataSet = new DataSet();
SqlDataAdapter printDataAdapter = new SqlDataAdapter();
printDataAdapter.SelectCommand = printCommand;
printDataAdapter.Fill(printDataSet,"receiptPrint");
DataTable dt = printDataSet.Tables[0];
LocalReport rep = reportViewer1.LocalReport;
this.reportViewer1.LocalReport.ReportEmbeddedResource = "ado.net.receipt.rdlc";
ReportDataSource prtRcpt = new ReportDataSource("printDataset_vw_reception_first(CU02)", printDataSet.Tables["vw_reception"]);
reportViewer1.LocalReport.DataSources.Clear();
reportViewer1.LocalReport.DataSources.Add(prtRcpt);
this.reportViewer1.RefreshReport();
}
}
}
Reply With Quote