16 Mca 57
16 Mca 57
Index.cs
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;
namespace lab1
{
public partial class Index : Form
{
public Index()
{
InitializeComponent();
}
}
}
}
EnterEmployee.cs
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;
namespace lab1
{
public partial class EnterEmployee : Form
{
SqlConnection con = new SqlConnection("Data Source=MCA-PC\\
SQLEXPRESS;Initial Catalog=db_EMS;Integrated Security=True");
public EnterEmployee()
{
InitializeComponent();
}
con.Open();{
SqlDataReader rs;
SqlCommand cmd = new SqlCommand("select [IdDesignation] from
tbl_Designations", con);
rs = cmd.ExecuteReader();
while (rs.Read())
{
comboBox1.Items.Add(rs[0].ToString());
} con.Close();
}
con.Open();
SqlDataReader rs1;
}
ViewProjectLeaders.cs
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;
namespace lab1
{
public partial class ViewProjectLeaders : Form
{
SqlConnection con = new SqlConnection("Data Source=MCA-PC\\
SQLEXPRESS;Initial Catalog=db_EMS;Integrated Security=True");
public ViewProjectLeaders()
{
InitializeComponent();
}
dataGridView1.DataSource = table;
con.Close();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
SqlDataReader rs3;
rs3 = cmdSql3.ExecuteReader();
while (rs3.Read())
{
comboBox1.Items.Add(rs3[0]);
comboBox1.SelectedItem = rs3[0];
}
rs3.Close();
con.Close();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
ViewEngineers.cs
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;
namespace lab1
{
public partial class ViewEngineers : Form
{
SqlConnection con = new SqlConnection("Data Source=MCA-PC\\
SQLEXPRESS;Initial Catalog=db_EMS;Integrated Security=True");
public ViewEngineers()
{
InitializeComponent();
}
dataGridView1.DataSource = table;
con.Close();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
SqlDataReader rs3;
rs3 = cmdSql3.ExecuteReader();
while (rs3.Read())
{
comboBox1.Items.Add(rs3[0]);
comboBox1.SelectedItem = rs3[0];
}
rs3.Close();
con.Close();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
}
}
ViewEmployees.cs
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;
namespace lab1
{
public partial class ViewEmployees : Form
{
SqlConnection con = new SqlConnection("Data Source=MCA-PC\\
SQLEXPRESS;Initial Catalog=db_EMS;Integrated Security=True");
public ViewEmployees()
{
InitializeComponent();
}
SqlDataReader rs3;
rs3 = cmdSql3.ExecuteReader();
/* while (rs3.Read())
{
comboBox1.Items.Add(rs3[0]);
comboBox1.SelectedItem = rs3[0];
}*/
rs3.Close();
con.Close();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
}
}