当前位置:Gxlcms > 数据库问题 > SQL Server 预编译执行SQLs

SQL Server 预编译执行SQLs

时间:2021-07-01 10:21:17 帮助过:48人阅读

(string.IsNullOrEmpty(name)) {   name = string.Empty; }

String sql = "select a.Id,a.UserName,a.TrueName,ISNULL(b.OTM, ‘0‘) as Flag from SysUser a left join FIX_MatchingModel b on cast(a.Id as varchar) = b.OTM and b.Id = @matchingId Where a.DepId = @DepId order by b.OTM desc";
SqlParameter[] sqlParameters = { new SqlParameter { ParameterName = "matchingId", Value = matchingId }, new SqlParameter { ParameterName = "DepId", Value = depId } };
DbContexts DbContext = new DbContexts();
return DbContext.Database.SqlQuery<UserView>(sql, sqlParameters).ToList();

 

SQL Server 预编译执行SQLs

标签:query   match   turn   param   项目   matching   xxx   return   tab   

人气教程排行