Ejemplo n.º 1
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(Bookhole_blog.Model.houtai_login model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update houtai_login set ");
            strSql.Append("houtai_pwd=@houtai_pwd,");
            strSql.Append("houtai_level=@houtai_level");
            strSql.Append(" where houtai_id=@houtai_id ");
            MySqlParameter[] parameters =
            {
                new MySqlParameter("@houtai_pwd",   MySqlDbType.VarChar, 255),
                new MySqlParameter("@houtai_level", MySqlDbType.Int32,    11),
                new MySqlParameter("@houtai_id",    MySqlDbType.Int32, 11)
            };
            parameters[0].Value = model.houtai_pwd;
            parameters[1].Value = model.houtai_level;
            parameters[2].Value = model.houtai_id;

            int rows = DbHelperMySQL.ExecuteSql(strSql.ToString(), parameters);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Ejemplo n.º 2
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public Bookhole_blog.Model.houtai_login DataRowToModel(DataRow row)
 {
     Bookhole_blog.Model.houtai_login model = new Bookhole_blog.Model.houtai_login();
     if (row != null)
     {
         if (row["houtai_id"] != null && row["houtai_id"].ToString() != "")
         {
             model.houtai_id = int.Parse(row["houtai_id"].ToString());
         }
         if (row["houtai_pwd"] != null)
         {
             model.houtai_pwd = row["houtai_pwd"].ToString();
         }
         if (row["houtai_level"] != null && row["houtai_level"].ToString() != "")
         {
             model.houtai_level = int.Parse(row["houtai_level"].ToString());
         }
     }
     return(model);
 }
Ejemplo n.º 3
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Bookhole_blog.Model.houtai_login GetModel(int houtai_id)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select houtai_id,houtai_pwd,houtai_level from houtai_login ");
            strSql.Append(" where houtai_id=@houtai_id ");
            MySqlParameter[] parameters =
            {
                new MySqlParameter("@houtai_id", MySqlDbType.Int32, 11)
            };
            parameters[0].Value = houtai_id;

            Bookhole_blog.Model.houtai_login model = new Bookhole_blog.Model.houtai_login();
            DataSet ds = DbHelperMySQL.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }