Пример #1
0
        public void GetLoaiTK()
        {
            string        sql       = @"server=DESKTOP-3PAL4OL\SQL; database=QLTK ; Integrated Security=true;";
            SqlConnection conection = new SqlConnection(sql);
            SqlDataReader read;
            SqlCommand    cmd = conection.CreateCommand();

            conection.Open();
            cmd.CommandText = "select * from LoaiTaiKhoan";
            read            = cmd.ExecuteReader();
            qlLoaitk        = new QLLoaiTK();
            while (read.Read())
            {
                LoaiTK loaitk = new LoaiTK();
                loaitk.MaLoai  = read.GetValue(0).ToString();
                loaitk.TenLoai = read.GetValue(1).ToString();
                qlLoaitk.ThemLoaiTK(loaitk);
            }
            cmd.Dispose();
            read.Close();
            conection.Close();
        }
Пример #2
0
 public void ThemLoaiTK(LoaiTK loaitk)
 {
     DanhSach.Add(loaitk);
 }