Click here to Skip to main content
15,890,512 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
//bind first ddl----------------------------------------------------
XML
public List<Dept_Desg_datatype> dept_Name()
      {
          List<Dept_Desg_datatype> rvm = new List<Dept_Desg_datatype>();
          MySqlConnection con = master.GetConnection();
          using (con)
          {
              MySqlCommand cmd = new MySqlCommand("select Dep_Name from department_table where Is_del='0' order by Dep_Name asc", con);

              con.Open();
              MySqlDataReader mysdr = cmd.ExecuteReader();
              while (mysdr.Read())
              {
                  Dept_Desg_datatype dd = new Dept_Desg_datatype();
                  dd.Dep_Name = mysdr["Dep_Name"].ToString();

                  rvm.Add(dd);
              }
              con.Close();
              return rvm;
          }

      }




//bind second ddl------------------------------------

public IEnumerable<payroll_model_class> Emp_List()
{

List<payroll_model_class> emp = new List<payroll_model_class>();
// Dept_Desg_datatype dept = new Dept_Desg_datatype();
MySqlConnection con = master.GetConnection();
using (con)

{


MySqlCommand cmd = new MySqlCommand("SELECT Emp_Id from Employee_tbl where Is_del='0' and Emp_Department=@Dep and Emp_Degsignaton=@desig", con);
cmd.Parameters.AddWithValue("@Dep", IT);
cmd.Parameters.AddWithValue("@desig", Developer);
con.Open();
MySqlDataReader mysder = cmd.ExecuteReader();
while (mysder.Read())
{
Payroll_Model_Class PMC = new Payroll_Model_Class();
PMC.Emp_Id = mysder["Emp_Id"].ToString();
emp.Add(PMC);
}
con.Close();
return emp;
}
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900