这个是写的一个处理数据分页的用户控件。
http://www.cnblogs.com/xingshao/archive/2010/01/30/1659640.html
至于存储过程.随便googel就可以了。
set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
go
ALTER PROCEDURE [dbo].[procCountStudentScore]
(
@teacherID int,
@pageNumber int,
@perPageNumber int,
@howManyItems int output
)
as
declare @StudentScoreItem table
(rowNumber int,
studentID int,
studentNum nvarchar(50),
studentName nvarchar(10),
className nchar(4),
studentScore float
)
insert into @StudentScoreItem
select ROW_NUMBER() over (order by tb_Student.studentID),
tb_student.studentID,
tb_Student.studentNum,
tb_Student.studentName,
tb_Class.className,
tb_Student.studentWeightScore * tb_Team.teamTotalScore
from tb_Student join tb_Class on tb_Student.studentClassID = tb_Class.classID
join tb_Team on tb_Student.studentTeamID = tb_Team.teamID
where tb_Class.classTeacherID = @teacherID
select @howManyItems = count(*) from @StudentScoreItem
select * from @StudentScoreItem
where rowNumber > (@pageNumber - 1) * @perPageNumber and
rowNumber <= @pageNumber * @perPageNumber