Beispiel #1
0
        public bool suaQuetMa(DTO_QuetMa tv)
        {
            try
            {
                // Ket noi
                connect.Open();

                // Query string
                string SQL = string.Format("UPDATE QUETMA " +
                                           "SET MASP = '{1}' " +
                                           "WHERE MAVACH = '{0}'",
                                           tv.MAVACH, tv.MASP);

                // Command (mặc định command type = text nên chúng ta khỏi fải làm gì nhiều).
                SqlCommand cmd = new SqlCommand(SQL, connect);

                // Query và kiểm tra
                if (cmd.ExecuteNonQuery() > 0)
                {
                    return(true);
                }
            }
            catch (Exception e)
            {
            }
            finally
            {
                // Dong ket noi
                connect.Close();
            }

            return(false);
        }
Beispiel #2
0
        public bool themQuetMa(DTO_QuetMa tv)// THẮNG
        {
            try
            {
                // Ket noi
                connect.Open();


                string SQL = string.Format("INSERT INTO QUETMA (MAVACH, MASP) " +
                                           "VALUES ('{0}', '{1}')",
                                           tv.MAVACH, tv.MASP); // DỮ LIỆU NHẬP VÀO

                // Command (mặc định command type = text nên chúng ta khỏi fải làm gì nhiều).
                SqlCommand cmd = new SqlCommand(SQL, connect);

                // Query và kiểm tra
                if (cmd.ExecuteNonQuery() > 0)
                {
                    return(true);
                }
            }
            catch (Exception e)
            {
            }
            finally
            {
                // Dong ket noi
                connect.Close();
            }

            return(false);
        }
Beispiel #3
0
 public bool suaData(DTO_QuetMa tv)
 {
     return(qm.suaQuetMa(tv));
 }
Beispiel #4
0
 public bool themData(DTO_QuetMa tv)
 {
     return(qm.themQuetMa(tv));
 }