Example #1
0
        public bool myExecuteReader(string sqlString, CommandType type, ref GiaoVien giaoVien)
        {
            bool canExecute;

            if (connection.State == ConnectionState.Open)
            {
                connection.Close();
            }
            connection.Open();

            command.CommandText = sqlString;
            command.CommandType = type;

            try
            {
                SqlDataReader reader = command.ExecuteReader();

                while (reader.Read())
                {
                    giaoVien.MaGV      = reader.GetString(0);
                    giaoVien.HoTen     = reader.GetString(1);
                    giaoVien.GioiTinh  = reader.GetString(2);
                    giaoVien.NgaySinh  = reader.GetDateTime(3);
                    giaoVien.DiaChi    = reader.GetString(4);
                    giaoVien.DienThoai = reader.GetString(5);
                    giaoVien.Mon       = reader.GetString(6);
                }

                canExecute = true;
            }
            catch
            {
                canExecute = false;
            }
            finally
            {
                connection.Close();
            }

            return(canExecute);
        }
Example #2
0
        public bool myExecuteReader(string sqlString, CommandType type, ref List <GiaoVien> giaoViens)
        {
            bool canExecute;

            if (connection.State == ConnectionState.Open)
            {
                connection.Close();
            }
            connection.Open();

            command.CommandText = sqlString;
            command.CommandType = type;

            try
            {
                SqlDataReader reader = command.ExecuteReader();

                while (reader.Read())
                {
                    GiaoVien giaoVien = new GiaoVien();
                    giaoVien.MaGV = reader.GetString(0);
                    giaoViens.Add(giaoVien);
                }

                canExecute = true;
            }
            catch
            {
                canExecute = false;
            }
            finally
            {
                connection.Close();
            }

            return(canExecute);
        }
Example #3
0
 partial void UpdateGiaoVien(GiaoVien instance);
Example #4
0
 partial void DeleteGiaoVien(GiaoVien instance);
Example #5
0
 partial void InsertGiaoVien(GiaoVien instance);