/// <summary> /// 更新一条数据 /// </summary> public static bool Update(Maticsoft.Model.DistrictYearExploitation model) { StringBuilder strSql = new StringBuilder(); strSql.Append("update DistrictYearExploitation set "); strSql.Append("YearExploitation=@YearExploitation"); strSql.Append(" where District=@District and Year=@Year "); SqlParameter[] parameters = { new SqlParameter("@YearExploitation", SqlDbType.Int, 4), new SqlParameter("@District", SqlDbType.BigInt, 8), new SqlParameter("@Year", SqlDbType.Int, 4) }; parameters[0].Value = model.YearExploitation; parameters[1].Value = model.District; parameters[2].Value = model.Year; int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters); if (rows > 0) { return(true); } else { return(false); } }
/// <summary> /// 增加一条数据 /// </summary> public static bool Add(Maticsoft.Model.DistrictYearExploitation model) { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into DistrictYearExploitation("); strSql.Append("District,Year,YearExploitation)"); strSql.Append(" values ("); strSql.Append("@District,@Year,@YearExploitation)"); SqlParameter[] parameters = { new SqlParameter("@District", SqlDbType.BigInt, 8), new SqlParameter("@Year", SqlDbType.Int, 4), new SqlParameter("@YearExploitation", SqlDbType.Int, 4) }; parameters[0].Value = model.District; parameters[1].Value = model.Year; parameters[2].Value = model.YearExploitation; int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters); if (rows > 0) { return(true); } else { return(false); } }