Esempio n. 1
0
        public bool chkLogin(string id, string pass)
        {
            ClsDb     db = new ClsDb();
            DataTable tb;

            try
            {
                StringBuilder sql = new StringBuilder();
                sql.AppendLine("SELECT * FROM users");
                sql.AppendLine("WHERE user_id = " + id);
                sql.AppendLine("AND password = "******"localhost", "master", "sa", "", -1);
                tb = db.ExecuteSql(sql.ToString(), -1);

                if (tb.Rows.Count == 0)
                {
                    return(false);
                }
            }
            catch (Exception e)
            {
            }
            finally
            {
                db.Disconnect();
            }

            return(true);
        }
Esempio n. 2
0
        internal List <ARTICLE> GetArticles()
        {
            List <ARTICLE> articles = new List <ARTICLE>();

            ClsDb     db = new ClsDb();
            DataTable tb;

            try
            {
                db.Connect("localhost", "master", "sa", "", -1);
                tb = db.ExecuteSql("select * from article_title order by create_date desc", -1);

                foreach (DataRow dr in tb.Rows)
                {
                    ARTICLE article = new ARTICLE();

                    article.kanri_no    = utils.NullChkToInt(dr["kanri_no"]);
                    article.title_no    = utils.NullChkToInt(dr["title_no"]);
                    article.title_name  = utils.NullChkString(dr["title_name"]);
                    article.title_msg   = utils.NullChkString(dr["title_msg"]);
                    article.create_user = utils.NullChkToInt(dr["create_user"]);
                }
            }catch (Exception e)
            {
            }finally
            {
                db.Disconnect();
            }
            return(articles);
        }