示例#1
0
        // 11/22/18_Heeyeong Kim
        public static DataTable DisplayReport(System.Web.UI.WebControls.ListView listView, int id, string table)
        {
            try
            {
                string         query = string.Format(@"SELECT * FROM " + table + " WHERE RecruitID=" + id);
                SqlDataAdapter sda   = new SqlDataAdapter(query, cn);
                DataTable      dt    = new DataTable();
                sda.Fill(dt);

                return(dt);
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }
示例#2
0
        // DisplayRecruits() takes one argument, connects to the database, retrieves Recruit table and fills the ListView object
        public static void DisplayRecruits(System.Web.UI.WebControls.ListView listView)
        {
            try
            {
                string         query = "Select * from Recruit";
                SqlDataAdapter sda   = new SqlDataAdapter(query, cn);

                DataTable dt = new DataTable();
                listView.DataSource = dt;
                sda.Fill(dt);
                listView.DataBind();
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }