Hi ..
I am Generating Data Report Using Telerik Report Viewer with out datasource .Instead of DataSource I am using Query To get the data .that data is assign to report . But The report is nothing displaying, the code is like
private void TeletikReport_Load(object sender, EventArgs e)
{
//// Creating and configuring the ObjectDataSource component:
var objectDataSource = GetData();
// Creating a new report
Telerik.Reporting.Report report = new Telerik.Reporting.Report();
report.DataSource = objectDataSource;
// Use the InstanceReportSource to pass the report to the viewer for displaying
Telerik.Reporting.InstanceReportSource reportSource = new Telerik.Reporting.InstanceReportSource();
reportSource.ReportDocument = report;
// Assigning the report to the report viewer.
reportViewer1.ReportSource = reportSource;
//// Calling the RefreshReport method in case this is a WinForms application.
reportViewer1.RefreshReport();
}
static DataView GetData()
{
const string connectionString = "Data Source=EMp;Initial Catalog=Emp;Integrated Security=True";
string selectCommandText = "SELECT * FROM Emp;";
SqlDataAdapter dataAdapter = new SqlDataAdapter(selectCommandText, connectionString);
DataTable dataTable = new DataTable();
dataAdapter.Fill(dataTable);
DataView dataView = dataTable.DefaultView;
return dataView;
}
Please , Help Where is the problem
I am Generating Data Report Using Telerik Report Viewer with out datasource .Instead of DataSource I am using Query To get the data .that data is assign to report . But The report is nothing displaying, the code is like
private void TeletikReport_Load(object sender, EventArgs e)
{
//// Creating and configuring the ObjectDataSource component:
var objectDataSource = GetData();
// Creating a new report
Telerik.Reporting.Report report = new Telerik.Reporting.Report();
report.DataSource = objectDataSource;
// Use the InstanceReportSource to pass the report to the viewer for displaying
Telerik.Reporting.InstanceReportSource reportSource = new Telerik.Reporting.InstanceReportSource();
reportSource.ReportDocument = report;
// Assigning the report to the report viewer.
reportViewer1.ReportSource = reportSource;
//// Calling the RefreshReport method in case this is a WinForms application.
reportViewer1.RefreshReport();
}
static DataView GetData()
{
const string connectionString = "Data Source=EMp;Initial Catalog=Emp;Integrated Security=True";
string selectCommandText = "SELECT * FROM Emp;";
SqlDataAdapter dataAdapter = new SqlDataAdapter(selectCommandText, connectionString);
DataTable dataTable = new DataTable();
dataAdapter.Fill(dataTable);
DataView dataView = dataTable.DefaultView;
return dataView;
}
Please , Help Where is the problem