コード例 #1
0
 public string XoaMayTinh(dtoMayTinh pMAMAY)
 {
     try
     {
         OpenConnect();
         string     XOA = string.Format("XAO_MAYTINH", pMAMAY);
         SqlCommand cmd = new SqlCommand(XOA, conn);
         cmd.CommandType = CommandType.StoredProcedure;
         cmd.Parameters.Add("@MAMAY", SqlDbType.Char).Value = pMAMAY;
         return(cmd.ExecuteNonQuery() > 0 ? "TRUE" : "FALSE");
     }
     catch (Exception E)
     {
         return(E.Message);
     }
 }
コード例 #2
0
        public string ThemMayTinh(dtoMayTinh MT)
        {
            try
            {
                OpenConnect();
                string     THEM = String.Format("THEM_MAYTINH", MT.MaMay, MT.TenMay, MT.CauHinh, MT.TinhTrang, MT.MaPhong);
                SqlCommand cmd  = new SqlCommand(THEM, conn);
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.Add("@MAMAY", SqlDbType.Char).Value     = MT.MaMay;
                cmd.Parameters.Add("@TENMAY", SqlDbType.Char).Value    = MT.TenMay;
                cmd.Parameters.Add("@CAUHINH", SqlDbType.Char).Value   = MT.CauHinh;
                cmd.Parameters.Add("@TINHTRANG", SqlDbType.Char).Value = MT.TinhTrang;
                cmd.Parameters.Add("@MAPHONG", SqlDbType.Char).Value   = MT.MaPhong;

                return(cmd.ExecuteNonQuery() > 0 ? "TRUE" : " FALSE");
            }
            catch (Exception e)
            {
                return(e.Message);
            }
        }