Exemplo n.º 1
0
        public static List <FeedBackQue> GetAll(int FeedBkId)
        {
            DBCon              OBJCon  = new DBCon();
            SqlCommand         cmd     = null;
            SqlDataReader      SDR     = null;
            List <FeedBackQue> ListTmp = new List <FeedBackQue>();

            try
            {
                string Query = "SELECT * FROM  FeedBackQuestion where FeedBkFormID=" + FeedBkId;
                cmd = new SqlCommand(Query, OBJCon.Con);
                SDR = cmd.ExecuteReader();
                while (SDR.Read())
                {
                    FeedBackQue ObjTmp = new FeedBackQue();
                    ObjTmp.ID           = SDR.GetInt32(0);
                    ObjTmp.Title        = SDR.GetString(1);
                    ObjTmp.Status       = SDR.GetBoolean(2);
                    ObjTmp.QuestionType = SDR.GetInt32(3);
                    ObjTmp.FeedBkFormID = SDR.GetInt32(4);
                    ObjTmp.OrderNo      = SDR.GetInt32(5);
                    ListTmp.Add(ObjTmp);
                }
            }
            catch (System.Exception e) { e.ToString(); }
            finally { cmd.Dispose();; OBJCon.Con.Close(); }

            return(ListTmp);
        }
Exemplo n.º 2
0
        public static FeedBackQue Getone(int QID)
        {
            DBCon         OBJCon = new DBCon();
            SqlCommand    cmd    = null;
            SqlDataReader SDR    = null;
            FeedBackQue   ObjTmp = new FeedBackQue();

            try
            {
                string Query = "SELECT TOP 1 * FROM  FeedBackQuestion where ID=" + QID;
                cmd = new SqlCommand(Query, OBJCon.Con);
                SDR = cmd.ExecuteReader();
                while (SDR.Read())
                {
                    ObjTmp.ID           = SDR.GetInt32(0);
                    ObjTmp.Title        = SDR.GetString(1);
                    ObjTmp.Status       = SDR.GetBoolean(2);
                    ObjTmp.QuestionType = SDR.GetInt32(3);
                    ObjTmp.FeedBkFormID = SDR.GetInt32(4);
                    ObjTmp.OrderNo      = SDR.GetInt32(5);
                }
            }
            catch (System.Exception e) { e.ToString(); }
            finally { cmd.Dispose();  OBJCon.Con.Close(); }
            return(ObjTmp);
        }