日期:2014-05-18 浏览次数:20532 次
/// <summary> /// 根据日期,资源名称,资源描述查询资源信息 /// </summary> /// <returns></returns> public DataSet FN_SerchByDateAndType(Guid FolderId, NRModel.File model, string createdate, string endate) { string strSql = "select * from t_File where 1 =1 and FolderId=@FolderId"; string strWhere = ""; if (!string.IsNullOrEmpty(model.FileNam)) { strWhere += " and FileNam like @FileNam"; } //if (!string.IsNullOrEmpty(model.Decription)k) //{ // strWhere += " and Decription like @Decription"; //} if (!string.IsNullOrEmpty(createdate) || !string.IsNullOrEmpty(endate)) { strWhere += " and CreateOn between @createdate and @endate order by ModefyOn desc"; } strSql += strWhere; SqlParameter[] parameters = { new SqlParameter("@FolderId", SqlDbType.UniqueIdentifier), new SqlParameter("@FileNam", SqlDbType.NVarChar, 256), new SqlParameter("@createdate", SqlDbType.NVarChar), new SqlParameter("@endate", SqlDbType.NVarChar) }; parameters[0].Value = FolderId; parameters[1].Value = "%" + model.FileNam + "%"; //parameters[1].Value = "%" + model.Decription + "%"; parameters[2].Value = createdate; parameters[3].Value = endate; return DbHelperSQL.Query(strSql, parameters); //SqlParameter[] parameters = new SqlParameter[4]; //parameters[0] = new SqlParameter("@FileNam", model.FileNam); //parameters[1] = new SqlParameter("@stardate", createdate); //parameters[2] = new SqlParameter("@enddate", endate); ////执行存储过程 //return DbHelperSQL.RunProcedure("P_UserSerch", parameters, "t_File"); }
------解决方案--------------------
select * from Table where name like '%张%' ||name like '%12%' || name like '%34%'
------解决方案--------------------
讲result分成单个的,然后
where 字段=result1 or 字段=result2 or 字段=result3
where部分用for语句来循环得到
------解决方案--------------------
难道我误解了- -`
------解决方案--------------------
楼主人呢?
------解决方案--------------------