TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Sidhdharthsinh Parmar
NA
1
1.1k
Report Viewer-Not able to diplay data.(it's nt givin error)
Feb 9 2013 7:39 AM
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];
}
}
Reply
Answers (
0
)
paasword
seperating a repeated block of code and reference it