#region 下移
private void SetDown(string id, string sort)
{
DbObject db = new DbObject();
DataSet ds = db.GetDataSet("select max(id) as id,max(sort) as sort from pub_gzxz where sort<" + sort);
if (ds.Tables[0].Rows.Count > 0)
{
string maxid = ds.Tables[0].Rows[0]["id"].ToString();
string maxsort = ds.Tables[0].Rows[0]["sort"].ToString();
if (!string.IsNullOrEmpty(maxid))
{
db.ExecuteSql("update pub_gzxz set sort=" + maxsort + " where id=" + id);
db.ExecuteSql("update pub_gzxz set sort=" + sort + " where id=" + maxid);
}
}
ds.Clear();
ds.Dispose();
db.Dispose();
}
#endregion
#region 上移
private void SetUp(string id, string sort)
{
DbObject db = new DbObject();
DataSet ds = db.GetDataSet("select min(id) as id,min(sort) as sort from pub_gzxz where sort>" + sort);
if (ds.Tables[0].Rows.Count > 0)
{
string minid = ds.Tables[0].Rows[0]["id"].ToString();
string minsort = ds.Tables[0].Rows[0]["sort"].ToString();
if (!string.IsNullOrEmpty(minid))
{
db.ExecuteSql("update pub_gzxz set sort=" + minsort + " where id=" + id);
db.ExecuteSql("update pub_gzxz set sort=" + sort + " where id=" + minid);
}
}
ds.Clear();
ds.Dispose();
db.Dispose();
}
#endregion
本文作者:网友 来源:网络收集
CIO之家 www.ciozj.com 微信公众号:imciow