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