/// <summary> /// 更新一条数据 /// </summary> public void Update(Model.Picture model) { StringBuilder strSql = new StringBuilder(); strSql.Append("update Picture set "); strSql.Append("TypeId=" + model.TypeId + ","); strSql.Append("ImgName='" + model.ImgName + "',"); strSql.Append("ImgUrl='" + model.ImgUrl + "'"); strSql.Append("Imgsdescribe='" + model.ImgUrl + "'"); strSql.Append(" where ID=" + model.ID + " "); SQLHelper.ExecuteNonQuery(strSql.ToString()); }
/// <summary> /// 增加一条数据 /// </summary> public void Add(Model.Picture model) { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into Picture("); strSql.Append("TypeId,ImgName,ImgUrl,Imgsdescribe"); strSql.Append(")"); strSql.Append(" values ("); strSql.Append("" + model.TypeId + ","); strSql.Append("'" + model.ImgName + "',"); strSql.Append("'" + model.ImgUrl + "',"); strSql.Append("'" + model.Imgsdescribe + "'"); strSql.Append(")"); SQLHelper.ExecuteNonQuery(strSql.ToString()); }
/// <summary> /// 得到一个对象实体 /// </summary> public Model.Picture GetModel(int ID) { StringBuilder strSql = new StringBuilder(); strSql.Append("select "); strSql.Append(" ID,TypeId,ImgName,ImgUrl,Imgsdescribe,date "); strSql.Append(" from Picture "); strSql.Append(" where ID=" + ID + " "); using (IDataReader dataReader = SQLHelper.ExecuteReader(strSql.ToString())) { if (dataReader.Read()) { model = ReaderBind(dataReader); } } return model; }
/// <summary> /// 更新一条数据 /// </summary> public void Update(Model.Picture model) { dal.Update(model); }
/// <summary> /// 增加一条数据 /// </summary> public void Add(Model.Picture model) { dal.Add(model); }