示例#1
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public bool Add(Hotel_app.Model.VIEW_S_czzt_zwmx model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into VIEW_S_czzt_zwmx(");
            strSql.Append("jzbh,czzt)");
            strSql.Append(" values (");
            strSql.Append("@jzbh,@czzt)");
            SqlParameter[] parameters =
            {
                new SqlParameter("@jzbh", SqlDbType.VarChar, 50),
                new SqlParameter("@czzt", SqlDbType.VarChar, 50)
            };
            parameters[0].Value = model.jzbh;
            parameters[1].Value = model.czzt;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
示例#2
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(Hotel_app.Model.VIEW_S_czzt_zwmx model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update VIEW_S_czzt_zwmx set ");
            strSql.Append("jzbh=@jzbh,");
            strSql.Append("czzt=@czzt");
            strSql.Append(" where ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@jzbh", SqlDbType.VarChar, 50),
                new SqlParameter("@czzt", SqlDbType.VarChar, 50)
            };
            parameters[0].Value = model.jzbh;
            parameters[1].Value = model.czzt;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
示例#3
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Hotel_app.Model.VIEW_S_czzt_zwmx GetModel()
        {
            //该表无主键信息,请自定义主键/条件字段
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 jzbh,czzt from VIEW_S_czzt_zwmx ");
            strSql.Append(" where ");
            SqlParameter[] parameters =
            {
            };

            Hotel_app.Model.VIEW_S_czzt_zwmx model = new Hotel_app.Model.VIEW_S_czzt_zwmx();
            DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                if (ds.Tables[0].Rows[0]["jzbh"] != null && ds.Tables[0].Rows[0]["jzbh"].ToString() != "")
                {
                    model.jzbh = ds.Tables[0].Rows[0]["jzbh"].ToString();
                }
                if (ds.Tables[0].Rows[0]["czzt"] != null && ds.Tables[0].Rows[0]["czzt"].ToString() != "")
                {
                    model.czzt = ds.Tables[0].Rows[0]["czzt"].ToString();
                }
                return(model);
            }
            else
            {
                return(null);
            }
        }