public void bindFacultyType()
        {
            String str = "";

            if (Session["User_Id"].ToString() == (100).ToString())
            {
                str = "";
            }
            else
            {
                str = " where FACID=" + Session["User_Id"].ToString();
            }

            try
            {
                if (con.State == ConnectionState.Open)
                {
                    con.Close();
                }
                con.Open();
                DataTable      dt  = new DataTable();
                SqlCommand     cmd = new SqlCommand("Select Distinct FACID from FACULTY_PROFILE$" + str, con);
                SqlDataAdapter da  = new SqlDataAdapter(cmd);
                da.Fill(dt);
                con.Close();
                Ddlfacultyid.DataSource     = dt;
                Ddlfacultyid.DataValueField = "FACID";
                Ddlfacultyid.DataBind();
                Ddlfacultyid.Items.Insert(0, new ListItem("Select", ""));
            }
            catch (Exception ee)
            {
                Response.Write("<script>alert('Error While Binding Faculty');</script>");
            }
        }
예제 #2
0
 public void bindFacultyType()
 {
     try
     {
         SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["UniversityDatabaseConnectionString"].ConnectionString);
         con.Open();
         DataTable      dt  = new DataTable();
         SqlCommand     cmd = new SqlCommand("Select Distinct FACID from FACULTY_PROFILE$", con);
         SqlDataAdapter da  = new SqlDataAdapter(cmd);
         da.Fill(dt);
         con.Close();
         Ddlfacultyid.DataSource     = dt;
         Ddlfacultyid.DataValueField = "FACID";
         Ddlfacultyid.DataBind();
         Ddlfacultyid.Items.Insert(0, new ListItem("Select", ""));
     }
     catch (Exception ee)
     {
         Response.Write("<script>alert('Error While Binding Faculty!!');</script>");
     }
 }