I am trying to use SQL Server Reporting Services in client mode, but something is going suspiciously. I have two tables in the IEPL_Attendance_DB database: Employee (EmployeeID, EmployeeName) and EmployeeTimeIn (EID, Time_In, Date_Ref, StateFlag) I want to show the report in Windows Form (C # in Visual Studio 2010). The report should be the result of the following query:
select e1.EID,e.EmployeeName,convert(varchar(5),SUM(e1.HoursConsumed)/3600)+':'+convert(varchar(5),SUM(e1.HoursConsumed)%3600/60)+':'+convert(varchar(5),(SUM(e1.HoursConsumed)%60)) as workingtime, CONVERT(VARCHAR(10),e1.Date_Ref,111) as Date_Ref from Employee as e, EmployeeTimeIn as e1 where e.EmployeeID = e1.EID group by e1.Date_Ref,e1.EID,e.EmployeeName;
I found this article: http://arcanecode.com/2009/03/23/using-sql-server-reporting-services-in-client-mode/ , which explains the step-by-step procedure for creating a report, but when I run my project , I see the following error in the report window:
A data source instance was not provided for the EmployeeAttendanceReport data source.
Here is my code:
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; //Add these to the standard list above using System.Data.Sql; using System.Data.SqlClient; using Microsoft.Reporting.WinForms; namespace EmployeeManager { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void Form1_Load(object sender, EventArgs e) { //this.reportViewer1.RefreshReport(); // Set the processing mode for the ReportViewer to Local reportViewer1.ProcessingMode = ProcessingMode.Local; LocalReport localReport = reportViewer1.LocalReport; localReport.ReportPath = @"F:\Muhammad Anees\Time In\WpfApplication1\EmployeeManager\AttendanceReport.rdlc"; DataSet dataset = new DataSet("EmployeeAttendanceReport"); // Get the sales order data GetCustomerOrders(ref dataset); // Create a report data source for the sales order data ReportDataSource dsCustomers = new ReportDataSource(); dsCustomers.Name = "EmployeeAttendanceReport_EmployeeAttendanceReport"; dsCustomers.Value = dataset.Tables["Employee"]; localReport.DataSources.Add(dsCustomers); // Refresh the report reportViewer1.RefreshReport(); } private void GetCustomerOrders(ref DataSet dsNorthwind) { string sqlCustomerOrders = "SELECT e1.EID" + " ,e.EmployeeName" + " ,CONVERT(VARCHAR(10),e1.Date_Ref,111) as Date_Ref" + " ,convert(varchar(5),SUM(e1.HoursConsumed)/3600)+':'+convert(varchar(5),SUM(e1.HoursConsumed)%3600/60)+':'+convert(varchar(5),(SUM(e1.HoursConsumed)%60)) as workingtime" + " FROM Employee as e, EmployeeTimeIn as e1" + " WHERE e.EmployeeID=e1.EID" + " GROUP BY e1.Date_Ref,e1.EID,e.EmployeeName"; SqlConnection connection = new SqlConnection("Data Source=AZEEMPC; " + "Initial Catalog=IEPL_Attendance_DB; " + "Trusted_Connection = true;"); SqlCommand command = new SqlCommand(sqlCustomerOrders, connection); SqlDataAdapter EmployeeAttendanceReportAdapter = new SqlDataAdapter(command); EmployeeAttendanceReportAdapter.Fill(dsNorthwind, "EmployeeAttendanceReport"); } } }
Notes:
1. SQL Query works fine, and I can see the output of this query in the sql server management studio.
2. Here are the properties of the DataSet: 
Please advise!