悬赏园豆:20
[已解决问题]
解决于 2008-06-02 18:51
exec sp_executesql N'WITH SearchResult AS <BR>( SELECT Row_Number() OVER (ORDER BY @SortExpression +'' '' + @SortDirection) AS RowID, <BR> UserID,<BR> FirstName,<BR> LastName,<BR> UserName,<BR> Status,<BR> UserRole<BR> FROM dbo.Users<BR> WHERE (Status = @Status OR @Status = -1) <BR> AND (FirstName LIKE <A href="mailto:''%''+@Keyword+''%''">''%''+@Keyword+''%''</A> OR LastName LIKE <A href="mailto:''%''+@Keyword+''%''">''%''+@Keyword+''%''</A> OR UserName LIKE <A href="mailto:''%''+@Keyword+''%''">''%''+@Keyword+''%''</A> OR @Keyword = '''')<BR>) SELECT * FROM SearchResult WHERE RowID > @PageIndex * @PageSize AND RowID <= (@PageIndex + 1) * @PageSize',<BR><A href="mailto:N'@Keyword">N'@Keyword</A> nvarchar(4000),@Status int,@PageIndex int,@PageSize int,@SortExpression nvarchar(8),@SortDirection nvarchar(4)',<BR>@Keyword=N'',@Status=-1,@PageIndex=0,@PageSize=1,@SortExpression=N'USERNAME',@SortDirection=N'asc'<BR>在上面的SQL语句中指定的排序参数 @SortExpression @SortDirection为什么不起作用,无论@SortDirection=N'asc'还是@SortDirection=N'desc',执行的结果始终是一样的顺序?
Leox
|
菜鸟二级
|
园豆:
461
提问于:2008-01-15 09:38