Esempio n. 1
0
        public void bindDatagridView()
        {
            list = cal.selectSehao();
            DataTable dt = new DataTable();

            dt.Columns.Add("Id", typeof(int));
            dt.Columns.Add("Name", typeof(String));
            dt.Columns.Add("SeHao1", typeof(String));
            foreach (Sehao s in list)
            {
                dt.Rows.Add(s.Id, s.Name, s.SeHao1);
            }
            dataGridView1.DataSource = dt;
        }