public int UpdateKeyWordsRank() { //1.删除热词表 string sqlDeleteKeyWords = @"truncate table KeyWordsRank"; CurrentDBSession.ExecuteSql(sqlDeleteKeyWords); //2.将热词表重新更新 string sqlUpdateKeyWordsRank = @"Insert into KeyWordsRank (Id,KeyWords,SearchCount) select newid(),SearchDetails.KeyWords,count(*) from SearchDetails where datediff(day,SearchDetails.SearchDateTime, getdate())<=7 group by SearchDetails.KeyWords"; return(CurrentDBSession.ExecuteSql(sqlUpdateKeyWordsRank)); }
public bool HandleApply(int aId, int aState, string remark2) { string sql = "update Apply set apply.State=@state,apply.Remark2=@remark where apply.Id=@id"; SqlParameter[] pars = { new SqlParameter("@state", System.Data.SqlDbType.Int), new SqlParameter("@remark", System.Data.SqlDbType.NVarChar, 50), new SqlParameter("@id", System.Data.SqlDbType.Int, 50) }; if (remark2 == null || remark2 == "") { pars[1].Value = DBNull.Value; } else { pars[1].Value = remark2; } pars[0].Value = aState; pars[2].Value = aId; return(CurrentDBSession.ExecuteSql(sql, pars) > 0); }