Sql Server 编写分页存储过程
来源:互联网 发布:php开源博客系统 编辑:程序博客网 时间:2024/05/21 17:44
一、Sql 存储过程中的编写及执行
--创建存储过程create proc BookInfo@pageSize int,@pageIndex intas select top(@pageSize) *from dbo.Books where BNO not in(select top(@pageSize*(@pageIndex-1)) BNOfrom dbo.Books )--这里只使用了单表查询,最常使用的是多表链接查询--使用情况exec BookInfo 5,5
二、程序中调用存储过程
string sqlConnection = "Data Source=.;Initial Catalog=LibrarySyatem;Integrated Security=True"; SqlConnection connection = new SqlConnection(sqlConnection); SqlCommand command = new SqlCommand("BookInfo", connection); command.CommandType = CommandType.StoredProcedure; command.Parameters.Add(new SqlParameter("@pageIndex", 5)); command.Parameters.Add(new SqlParameter("@pageSize", 5)); SqlDataAdapter ad = new SqlDataAdapter(command); DataSet ds = new DataSet(); ad.Fill(ds); this.GridView1.DataSource = ds; this.GridView1.DataBind();
效果图:
0 0
- Sql Server 编写分页存储过程
- SQL Server 分页存储过程
- 分页存储过程(SQL Server)
- SQL Server 分页存储过程
- SQL Server 分页存储过程
- SQL Server 分页存储过程
- SQL Server 分页存储过程
- SQL SERVER 分页存储过程
- SQL Server 分页存储过程
- sql server分页存储过程
- SQL Server分页存储过程
- SQL Server分页存储过程
- sql server 分页存储过程
- sql server存储过程分页
- SQL server分页存储过程
- SQL server 分页存储过程
- Sql Server 分页存储过程
- Sql Server 分页存储过程
- IOS游戏开发之cocos2d-x实现自定义字体
- ACM气球膨胀问题C++实现
- C++实现贪心算法-区间覆盖问题
- 安卓项目的创建以及注意事项
- 最全的常用正则表达式大全
- Sql Server 编写分页存储过程
- java通过InputStream读取和写入文件操作实例代码
- 解决Eclipse导入安卓工程路径出错问题
- 原创记忆小游戏-HTML网页版
- mysql面试问题
- 原创记忆小游戏-Android增强版
- Windows Embedded Standard 7 快速入门指南 3 of 4
- opencv 获取Mat像素值
- 第十一篇:Harr特征博文讲解集