public int WUpdate(Hashtable setht, Hashtable wht) { if (setht == null || wht == null) { return(0); } string sql = IOHelper.GetSqlUpdate(DbTable, setht, wht); return(RunDB.ExecuteNonQuery(sql, setht, DbConnectionString)); }
public int WUpdate(Hashtable setht, object pkval) { if (setht == null || setht.Count < 1 || pkval == null) { return(0); } var wht = new Hashtable(); wht[Spring.PKName] = pkval; string sql = IOHelper.GetSqlUpdate(DbTable, setht, wht); return(RunDB.ExecuteNonQuery(sql, setht, DbConnectionString)); }
public int DeleteByHashtable(Hashtable ht) { if (ht == null || ht.Count < 1) { return(-1); //不允许清空一个表 } Hashtable htWhere = new Hashtable(); string sql = "delete from " + DbTable + " "; string sqlWhere = IOHelper.GetSqlWhere(ht, htWhere, User_MSSQL); if (!String.IsNullOrEmpty(sqlWhere) && (sqlWhere.Trim().IndexOf(" ") > 0 || sqlWhere.Length > 4)) { sqlWhere = sqlWhere.Trim(); if (!sqlWhere.StartsWith("where ", StringComparison.OrdinalIgnoreCase)) { sqlWhere = " where " + sqlWhere; } sql += sqlWhere; } return(RunDB.ExecuteNonQuery(sql, htWhere, DbConnectionString)); }