Vous êtes sur la page 1sur 6

using System;

using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Data.SqlClient;
using Microsoft.Reporting.WinForms;

namespace FinalYearWindowsFormsApplication
{
public partial class ReportAssign : Form
{
public ReportAssign()
{
InitializeComponent();
}

SqlConnection con;
private void resultassign_Load(object sender, EventArgs e)
{
// TODO: This line of code loads data into the 'FinalProDBDataSet1.assigninternal' table.
You can move, or remove it, as needed.

con = new SqlConnection(@"Data


Source=(LocalDB)\v11.0;AttachDbFilename=C:\Users\AQIB ALI\documents\visual studio
2012\Projects\FinalYearWindowsFormsApplication\FinalYearWindowsFormsApplication\FinalProDB.
mdf;Integrated Security=True");
con.Open();
comboload();
this.reportViewer1.RefreshReport();
}
public void comboload()
{
string q = "select Distinct ClassName from assigninternal";
SqlCommand cmd = new SqlCommand(q, con);
SqlDataReader reader = cmd.ExecuteReader();
while (reader.Read())
{
comboBox1.Items.Add(reader.GetValue(0).ToString());

}
cmd.Dispose();
reader.Close();
}

private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)


{
comboBox2.Items.Clear();
comboBox3.Items.Clear();
string q = "select *from assigninternal where ClassName ='" + comboBox1.Text + "' ";
SqlCommand cmd = new SqlCommand(q, con);
SqlDataReader reader = cmd.ExecuteReader();
while (reader.Read())
{
comboBox2.Items.Add(reader.GetValue(4));
comboBox3.Items.Add(reader.GetValue(5));
}
cmd.Dispose();
reader.Close();

private void comboBox3_SelectedIndexChanged(object sender, EventArgs e)


{
string sql = "select *from assigninternal where ClassName = '" + comboBox1.Text+ "'
AND Session = '"+comboBox2.Text+"' AND Timing = '"+comboBox3.Text+"'";
try
{

SqlDataAdapter da = new SqlDataAdapter(sql, con);


DataSet ds1 = new DataSet("DataSet1");
da.Fill(ds1, "assigninternal");
String ClassName = (ds1.Tables[0].Rows[0][3].ToString());
String Session = (ds1.Tables[0].Rows[0][4].ToString());
String Timing = (ds1.Tables[0].Rows[0][5].ToString());
ReportDataSource rds = new ReportDataSource("DataSet1", ds1.Tables[0] as
DataTable);
this.assigninternalTableAdapter.Fill(this.FinalProDBDataSet1.assigninternal);
reportViewer1.LocalReport.DataSources.Clear();
reportViewer1.LocalReport.ReportEmbeddedResource =
"FinalYearWindowsFormsApplication.Report1.rdlc";
reportViewer1.LocalReport.DataSources.Add(rds);
ReportParameter p1 = new ReportParameter("classn", ClassName);
ReportParameter p2 = new ReportParameter("sess", Session);
ReportParameter p3 = new ReportParameter("time", Timing);
this.reportViewer1.LocalReport.SetParameters(p1);
this.reportViewer1.LocalReport.SetParameters(p2);
this.reportViewer1.LocalReport.SetParameters(p3);
this.reportViewer1.RefreshReport();
}

catch (Exception)
{
}
}

private void comboBox2_SelectedIndexChanged(object sender, EventArgs e)


{

}
}

}
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Data.SqlClient;
using Microsoft.Reporting.WinForms;

namespace FinalYearWindowsFormsApplication
{
public partial class resultinternal : Form
{
public resultinternal()
{
InitializeComponent();
}

SqlConnection con;
private void resultinternal_Load(object sender, EventArgs e)
{
// TODO: This line of code loads data into the 'FinalProDBDataSet2.resultinternal' table.
You can move, or remove it, as needed.

con = new SqlConnection(@"Data


Source=(LocalDB)\v11.0;AttachDbFilename=c:\users\aqib ali\documents\visual studio
2012\Projects\FinalYearWindowsFormsApplication\FinalYearWindowsFormsApplication\FinalProDB.
mdf;Integrated Security=True");
con.Open();
comboload();
this.reportViewer1.RefreshReport();
}
public void comboload()
{

string q = "select Distinct YearlyEvaluationClass from resultinternal";


SqlCommand cmd = new SqlCommand(q, con);
SqlDataReader reader = cmd.ExecuteReader();
while (reader.Read())
{
comboBox1.Items.Add(reader.GetValue(0).ToString());

}
cmd.Dispose();
reader.Close();
}

private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)


{
comboBox2.Items.Clear();
comboBox3.Items.Clear();
string q = "select *from resultinternal where YearlyEvaluationClass ='" + comboBox1.Text
+ "' ";
SqlCommand cmd = new SqlCommand(q, con);
SqlDataReader reader = cmd.ExecuteReader();
while (reader.Read())
{

comboBox2.Items.Add(reader.GetValue(5));
comboBox3.Items.Add(reader.GetValue(2));
}
cmd.Dispose();
reader.Close();
}

private void comboBox3_SelectedIndexChanged(object sender, EventArgs e)


{
string sql = "select *from resultinternal where YearlyEvaluationClass = '" +
comboBox1.Text + "' AND Session = '" + comboBox2.Text + "' AND Timing = '" +
comboBox3.Text + "'";
try
{

SqlDataAdapter da = new SqlDataAdapter(sql, con);


DataSet ds1 = new DataSet("DataSet1");
da.Fill(ds1, "resultinternal");
String ClassName = (ds1.Tables[0].Rows[0][1].ToString());
String Session = (ds1.Tables[0].Rows[0][5].ToString());
String Timing = (ds1.Tables[0].Rows[0][2].ToString());
ReportDataSource rds = new ReportDataSource("DataSet1", ds1.Tables[0] as
DataTable);
this.resultinternalTableAdapter.Fill(this.FinalProDBDataSet2.resultinternal);
reportViewer1.LocalReport.DataSources.Clear();
reportViewer1.LocalReport.ReportEmbeddedResource =
"FinalYearWindowsFormsApplication.Report2.rdlc";
reportViewer1.LocalReport.DataSources.Add(rds);
ReportParameter p1 = new ReportParameter("classn", ClassName);
ReportParameter p2 = new ReportParameter("sess", Session);
ReportParameter p3 = new ReportParameter("time", Timing);
this.reportViewer1.LocalReport.SetParameters(p1);
this.reportViewer1.LocalReport.SetParameters(p2);
this.reportViewer1.LocalReport.SetParameters(p3);
this.reportViewer1.RefreshReport();
}

catch (Exception)
{

private void comboBox2_SelectedIndexChanged(object sender, EventArgs e)


{

}
}
}
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Data.SqlClient;
using Microsoft.Reporting.WinForms;

namespace FinalYearWindowsFormsApplication
{
public partial class resultexternal : Form
{
public resultexternal()
{
InitializeComponent();
}

SqlConnection con;
private void resultexternal_Load(object sender, EventArgs e)
{
// TODO: This line of code loads data into the 'FinalProDBDataSet3.resultexternal' table.
You can move, or remove it, as needed.

con = new SqlConnection(@"Data


Source=(LocalDB)\v11.0;AttachDbFilename=c:\users\aqib ali\documents\visual studio
2012\Projects\FinalYearWindowsFormsApplication\FinalYearWindowsFormsApplication\FinalProDB.
mdf;Integrated Security=True");
con.Open();
comboload();
this.reportViewer1.RefreshReport();
}
public void comboload()
{

string q = "select Distinct YearlyEvaluationClass from resultexternal";


SqlCommand cmd = new SqlCommand(q, con);
SqlDataReader reader = cmd.ExecuteReader();
while (reader.Read())
{
comboBox1.Items.Add(reader.GetValue(0).ToString());

}
}

private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)


{
comboBox2.Items.Clear();
comboBox3.Items.Clear();
string q = "select *from resultexternal where YearlyEvaluationClass ='" + comboBox1.Text
+ "' ";
SqlCommand cmd = new SqlCommand(q, con);
SqlDataReader reader = cmd.ExecuteReader();
while (reader.Read())
{

comboBox2.Items.Add(reader.GetValue(6));
comboBox3.Items.Add(reader.GetValue(2));
}
cmd.Dispose();
reader.Close();
}

private void comboBox3_SelectedIndexChanged(object sender, EventArgs e)


{
string sql = "select *from resultexternal where YearlyEvaluationClass = '" +
comboBox1.Text + "' AND Session = '" + comboBox2.Text + "' AND Timing = '" +
comboBox3.Text + "'";
try
{

SqlDataAdapter da = new SqlDataAdapter(sql, con);


DataSet ds1 = new DataSet("DataSet1");
da.Fill(ds1, "resultinternal");
String ClassName = (ds1.Tables[0].Rows[0][1].ToString());
String Session = (ds1.Tables[0].Rows[0][6].ToString());
String Timing = (ds1.Tables[0].Rows[0][2].ToString());
ReportDataSource rds = new ReportDataSource("DataSet1", ds1.Tables[0] as
DataTable);
this.resultexternalTableAdapter.Fill(this.FinalProDBDataSet3.resultexternal);
reportViewer1.LocalReport.DataSources.Clear();
reportViewer1.LocalReport.ReportEmbeddedResource =
"FinalYearWindowsFormsApplication.Report3.rdlc";
reportViewer1.LocalReport.DataSources.Add(rds);
ReportParameter p1 = new ReportParameter("classn", ClassName);
ReportParameter p2 = new ReportParameter("sess", Session);
ReportParameter p3 = new ReportParameter("time", Timing);
this.reportViewer1.LocalReport.SetParameters(p1);
this.reportViewer1.LocalReport.SetParameters(p2);
this.reportViewer1.LocalReport.SetParameters(p3);
this.reportViewer1.RefreshReport();
}

catch (Exception)
{

}
}

private void comboBox2_SelectedIndexChanged(object sender, EventArgs e)


{

}
}
}