SqlParameter[] sqlParams = new SqlParameter[2];
sqlParams[0] = new SqlParameter("@RoleId", roleName);
sqlParams[1] = new SqlParameter("@Deleted", false) { DbType = System.Data.DbType.Boolean };
var q = Context.Database.SqlQuery<UserInfo>("exec GetUsersByRoleID @RoleId,@Deleted", sqlParams);
return q.ToListAsync();
USE [OLsuitedb]
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER PROCEDURE [dbo].[GetSiteTracks]
(
@ShortUrl nvarchar(max)
)
AS
BEGIN
DECLARE @wheres nvarchar(max)
set @wheres=' where 1=1 '
if @ShortUrl != '' begin
set @wheres += ' and ShortUrl = @ShortUrl'
end
declare @sql nvarchar(max)
set @sql = N'select Source,COUNT(Source) as NumCount from SiteTracks'+ @wheres+' group by Source'
print @sql
exec sp_executesql @sql,N'@ShortUrl nvarchar(max)',@ShortUrl
END