Asp Gridview结合模糊查询(全文索引)的分页(2)
on '+@TempIDName+'=k.[key]
where '+@TempTypeIDName+'='+CONVERT(nvarchar,@TempTypeID)+''
exec sp_executeSQL @sql
正式分页存储过程
Create Procedure Popular_PageList
@ContentOne nvarchar(20), --查询关键字
@ContentTwo nvarchar(20),
@ContentThree nvarchar(20),
@CurrentCount int, ----当前的索引,假设每页5条数据,第二页的话,currencount为10
@num int, --每页的条数
@TempTypeID int, --所属分类
@TempTypeIDName nvarchar(50), --所属分类名 与上对应 两个是一起的
@fieldOne nvarchar(20), --要查询的字段 强规
@fieldTwo nvarchar(20), --一般规
@TempIDName nvarchar(20), --要排序的ID
@Table nvarchar(20) --要查询的表
AS
declare @Sql nvarchar(300)
declare @opreat nvarchar(20)
if @ContentTwo is null or @ContentTwo=''
set @opreat='or'
else
set @opreat='and'
set @Sql='with cte as(select top '+CONVERT(nvarchar,@CurrentCount)+' *,row_number() over(order by '+@TempIDName+' asc) as num from '+@Table+'
inner join containstable('+@Table+',(['+@fieldOne+'],['+@fieldTwo+']),''("'+@ContentOne+'") '+@opreat+' ("'+@ContentTwo+'")or("'+@ContentThree+'")'',50) as k
on '+@TempIDName+'=k.[key]
where '+@TempTypeIDName+'='+CONVERT(nvarchar,@TempTypeID)+'
order by '+@TempIDName+' asc)
select * from cte where num>'+CONVERT(nvarchar,@num)+''
exec sp_executeSQL @sql
页面前台:
<table width="100%" border="1" cellpadding="0" cellspacing="0">
<tr>
<td width="90px">规范名称:</td>
<td>
<asp:TextBox ID="txtSstand" runat="server" Width="249px"></asp:TextBox></td>
<td>
相关新闻>>
- 发表评论
-
- 最新评论 更多>>