0
Answer

Report Viewer-Not able to diplay data.(it's nt givin error)

Hello friends,
I need your help..I am binding report viewer by coding using dataset.
It runs successfully but not showing any data.It simply shows reportviewer control which I have put in default.aspx page.Here is my code..pl help me..
public partial class _Default : System.Web.UI.Page
{
string connectionString = WebConfigurationManager.ConnectionStrings["NirmanGroupConnectionString"].ConnectionString;
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
ReportViewer1.ProcessingMode = ProcessingMode.Local;
ReportViewer1.LocalReport.ReportPath = "Report.rdlc";
ReportDataSource rdS = new ReportDataSource("Dataset1", GetData());
ReportViewer1.LocalReport.DataSources.Add(rdS);
ReportViewer1.DataBind();
ReportViewer1.LocalReport.Refresh();
}
}
public DataTable GetData()
{
SqlDataAdapter dta = new SqlDataAdapter();
 
SqlConnection con = new SqlConnection(connectionString);
 
DataSet ds = new DataSet();
 
SqlCommand cmd = new SqlCommand("SELECT [Vendor_Code],[Company_Name],[First_Name],[Last_Name] FROM Vendor_Entry",con);
 
dta.SelectCommand = cmd;
 
dta.SelectCommand.Connection = con;
 
dta.Fill(ds, "Vendor_Entry");
 
return ds.Tables[0];
}
}