Diễn đàn    ASP.NET & Sharepoint MOSS, WSS 2007    [Help] phân trang stored proceduce?

Thành viênTrả lời
bachdienquandhcn@gmail.com


1  bài
18-5-2012 15:46:14
Moiij người giúp mình với....
set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
go


ALTER PROCEDURE [dbo].[usp_hienvd_get_song_bysinger]
-- Add the parameters for the stored procedure here
@id_casy INT,
@id_baihat INT,
@PageIndex INT,
@PageSize INT
AS
BEGIN
WITH DsAlbum AS (
SELECT ROW_NUMBER() OVER (ORDER BY tb_casy.id_casy DESC) AS RowIndex,tb_baihat.id_baihat as idbh,
tb_casy.ten_casy as cs,tb_baihat.ten_baihat as bh
from tb_casy,tb_baihat
where tb_casy.id_casy=tb_baihat.id_casy and tb_baihat.id_baihat=@id_baihat
) , GetTotalRowCount AS (
SELECT MAX(RowIndex) AS TotalRowCount
FROM DsAlbum
)
SELECT cs,bh, TotalRowCount
FROM DsAlbum, GetTotalRowCount
WHERE (RowIndex BETWEEN (@PageIndex - 1) * @PageSize + 1 AND @PageIndex*@PageSize)
END
-----------------------------------------------------------------
code cần phân trang:
public string listsonghot()
{
string strSong = "";

DataTable tblData = tl.GetAllTopByTypeMusic(6,5,5);
if (tblData.Rows.Count > 0)
{
foreach (DataRow dr in tblData.Rows)
{
string ma_nhaccho = "";
if (String.IsNullOrEmpty(dr["MaNhac"].ToString()))
{
ma_nhaccho = "dang cap nhat";
}
else
ma_nhaccho = dr["MaNhac"].ToString();
strSong += @"
<div class='list-items'>
<div class='back_list'> <a href='#'>
<table width='100%' border='0' cellspacing='0' cellpadding='0'>
<tbody><tr>
<td width='35' align='left'><img src='images/play.png' alt='play' height='28' width='28'></td>
<td><span class='title'> " + dr["TenBaiHat"] + @" </span> <span class='text'> " + dr["TenCasy"] + @" </span></td>
<td class='maso' valign='middle'>" + ma_nhaccho + @"</td>
</tr>
</tbody></table>
</a> </div>
</div>";

}
}
---------------------------------------
Minh đang cần phân trang bằng code chứ ko bằng user control. Mình dốt mấy cái này...hic
 

Chủ đề gần đây :

Cùng loại :

Tên file Mô tả chi tiết Ngày
NWeb.zip (1) Module đơn giản Newsweb trên Dotnetnuke v10.x.x.x10/18/2025 8:08:11 AM
vspforum.zip (11) Ma nguon vspforum ngay xua4/18/2023 6:38:37 AM
pdfjs.rar (2) pdfjs 2017 : hiển thị tốt trên iphone 11, 12, 13 không lỗi, bản 2012 sẽ lỗi trên iphone6/21/2022 11:52:48 AM
pdfjs2.rar (2) Xem file pdf bằng viewer.hml cua pdfjs (thư viện chuẩn mozilla) 2012. https://mozilla.github.io/pdf.js/getting_started/#download có thể download bản prebuild tại đây6/21/2022 11:52:04 AM
runner.zip (0) using three.js, orbitcontrol to view an object move random on map. Di chuyển 1 đồ vật ngẫu nhiên trên bản đồ, sử dụng với demo nhân viên di chuyển trong văn phòng. Toàn js download về là chạy12/5/2019 5:55:14 PM
gmap.zip (1) google map + marker7/17/2019 2:25:05 PM
vinsmarthomeservice.zip (1) java post json to api, use AsyncTask, event listener7/9/2019 5:00:10 PM
fblogin.zip (0) Login facebook bang javascript SDK7/9/2019 9:16:37 AM
autocomplete-location.zip (2) autocomplete location geo from google place, html + js7/4/2019 4:37:55 PM
WebAPI.zip (8) api for android access db (v1.0.0)7/4/2019 9:14:17 AM