using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Microsoft.Reporting.WebForms;
using System.Configuration;
using System.Data.SqlClient;
using System.Data;
namespace RDLCTEST
{
public partial class WebForm1 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
ReportViewer1.ProcessingMode = ProcessingMode.Local;
ReportViewer1.LocalReport.ReportPath = Server.MapPath("~/Report1.rdlc");
DataSet1 ds = GetData("select * from Employee");
ReportDataSource datasource = new ReportDataSource("DataSet1", ds.Tables[0]);
ReportViewer1.LocalReport.DataSources.Clear();
ReportViewer1.LocalReport.DataSources.Add(datasource);
}
}
private DataSet1 GetData(string qury)
{
string cn = ConfigurationManager.ConnectionStrings["RDLCConnectionString"].ConnectionString;
SqlCommand cmd = new SqlCommand(qury);
SqlConnection con = new SqlConnection(cn);
SqlDataAdapter da = new SqlDataAdapter();
cmd.Connection = con;
da.SelectCommand = cmd;
DataSet1 ds = new DataSet1();
da.Fill(ds, "Employee");
return ds;
}
protected void Button1_Click(object sender, EventArgs e)
{
ReportViewer1.ProcessingMode = ProcessingMode.Local;
ReportViewer1.LocalReport.ReportPath = Server.MapPath("~/Report1.rdlc");
DataSet1 ds = GetData("select * from Employee where Name='"+TextBox1.Text+"' ");
ReportDataSource datasource = new ReportDataSource("DataSet1", ds.Tables[0]);
ReportViewer1.LocalReport.DataSources.Clear();
ReportViewer1.LocalReport.DataSources.Add(datasource);
}
}
}
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Microsoft.Reporting.WebForms;
using System.Configuration;
using System.Data.SqlClient;
using System.Data;
namespace RDLCTEST
{
public partial class WebForm1 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
ReportViewer1.ProcessingMode = ProcessingMode.Local;
ReportViewer1.LocalReport.ReportPath = Server.MapPath("~/Report1.rdlc");
DataSet1 ds = GetData("select * from Employee");
ReportDataSource datasource = new ReportDataSource("DataSet1", ds.Tables[0]);
ReportViewer1.LocalReport.DataSources.Clear();
ReportViewer1.LocalReport.DataSources.Add(datasource);
}
}
private DataSet1 GetData(string qury)
{
string cn = ConfigurationManager.ConnectionStrings["RDLCConnectionString"].ConnectionString;
SqlCommand cmd = new SqlCommand(qury);
SqlConnection con = new SqlConnection(cn);
SqlDataAdapter da = new SqlDataAdapter();
cmd.Connection = con;
da.SelectCommand = cmd;
DataSet1 ds = new DataSet1();
da.Fill(ds, "Employee");
return ds;
}
protected void Button1_Click(object sender, EventArgs e)
{
ReportViewer1.ProcessingMode = ProcessingMode.Local;
ReportViewer1.LocalReport.ReportPath = Server.MapPath("~/Report1.rdlc");
DataSet1 ds = GetData("select * from Employee where Name='"+TextBox1.Text+"' ");
ReportDataSource datasource = new ReportDataSource("DataSet1", ds.Tables[0]);
ReportViewer1.LocalReport.DataSources.Clear();
ReportViewer1.LocalReport.DataSources.Add(datasource);
}
}
}
No comments:
Post a Comment