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
Amit Aggarwal
NA
1
813
Reporting Service in ASP.NEt Using C#
Mar 2 2015 11:53 PM
I get this Error "
A data source instance has not been supplied for the data source 'DataSet1'.
"
instance is there...help me out please
My code is Correct...??
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;
using Microsoft.Reporting.WebForms;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
ReportViewer1.ProcessingMode = ProcessingMode.Local;
ReportViewer1.LocalReport.ReportPath = Server.MapPath("~/Report.rdlc");
UserInformation dsEmployees = GetData("select top 10 * from UserInformation");
ReportDataSource datasource = new ReportDataSource("UserInformation", dsEmployees.Tables[0]);
ReportViewer1.LocalReport.DataSources.Clear();
ReportViewer1.LocalReport.DataSources.Add(datasource);
}
}
private UserInformation GetData(string query)
{
string conString = @"Data Source=######;Initial Catalog=Example;Integrated Security=True";
SqlCommand cmd = new SqlCommand(query);
using (SqlConnection con = new SqlConnection(conString))
{
using (SqlDataAdapter sda = new SqlDataAdapter())
{
cmd.Connection = con;
sda.SelectCommand = cmd;
using (UserInformation dsEmployees = new UserInformation())
{
sda.Fill(dsEmployees, "DataTable1");
return dsEmployees;
}
}
}
}
}
Reply
Answers (
1
)
Powershell need to log when a file is created and owner
how to pass crystal report fourmula fields value at run time