Hi,
i have a problem with the reportviewer, and i want to bind a report with a subreport, i use 2 different data bases which:
- table enseignants( id,nom,prenom ...) from access data base
- table HeureSupp(id, heure cr, heure TD ,...) from sql server data base
I want to display the data of both entities in the same report, I have already made a solution but my source code is not well organized, can anyone help me please?
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;
- using System.Data.SqlClient;
- using System.Data.OleDb;
- using Microsoft.Reporting.WinForms;
- namespace reportSubreport
- {
- public partial class Form1 : Form
- {
- public Form1()
- {
- InitializeComponent();
- }
- private DataTable infoenseignant = null;
- private DataTable LoadHS()
- {
- string strconnSql = @"Data Source=WAYDE-PC\SQLEXPRESS; Initial Catalog=HeureSuppl; Integrated Security=SSPI;";
- ensAdapter.Fill(dataSet, "heuresupp4");
- return dataSet.Tables[0];
- }
- private DataTable Loadensinf()
- {
- string strconnAccess = @"Provider=Microsoft.Jet.OLEDB.4.0;" + @"Data source= C:\Users\wayde\Desktop\Developpemnt de l'application\Base de donnée\base vide.mdb";
- HSAdapter.Fill(dataSet, "enseignant");
- return dataSet.Tables[0];
- }
- void SubreportProcessingEventHandler(object sender, SubreportProcessingEventArgs e)
- {
- if (infoenseignant == null)
- infoenseignant = Loadensinf();
- }
- private void Form1_Load(object sender, EventArgs e)
- {
- reportViewer.ProcessingMode = ProcessingMode.Local;
- reportViewer.LocalReport.ReportPath = @"C:\Users\wayde\Desktop\appl exemple\testcodevb\reportSubreport\reportSubreport\Report1.rdlc";
- reportViewer.LocalReport.SubreportProcessing +=
- reportViewer.LocalReport.DataSources.Add(
- reportViewer.Dock = DockStyle.Fill;
- this.Controls.Add(reportViewer);
- this.reportViewer1.RefreshReport();
- }
- }
- }
- 25 views