/// <summary> /// 处理多余的数据 /// </summary> /// <param name="tblName">表名</param> /// <param name="key">键值</param> /// <param name="maxKey">最大键值</param> /// <param name="minKey">最小键值</param> private void ProcessRemainData(string tblName, string key, string maxKey, string minKey) { string sql = string.Format("delete from {0} where {1}<@minKey or {1}>@maxKey", tblName, key); Dictionary <string, object> pms = new Dictionary <string, object>(); pms.Add("@maxKey", maxKey); pms.Add("@minKey", minKey); LocalServer.QueryInt(sql, pms); }
/// <summary> /// 删除数据 /// </summary> /// <param name="listRowsNeed2Delete">需要删除的数据</param> /// <param name="syncData">参数对象</param> private void DeleteRowsNeed2Delete(List <DataRow> listRowsNeed2Delete, MyArgs syncData) { if (listRowsNeed2Delete == null) { return; } if (listRowsNeed2Delete.Count <= 0) { return; } List <string> list = listRowsNeed2Delete.Select(a => a.Field <string>(syncData.Key)).ToList(); string keysStr = string.Join("','", list.ToArray()); keysStr = string.Format("'{0}'", keysStr); string sqlStr = string.Format("delete from {0} where {1} in ({2})", syncData.TblName, syncData.Key, keysStr); LocalServer.QueryInt(sqlStr); }