N
noLoveLusT
hi everyone i am very very new to the sql server (2 days actually and ) so
far i learned creating SPs etc but couldnt workout how to get return value
from my prodecure
my sp as follows
________________________
CREATE PROCEDURE [dbo].[page_all_artists]
@PageIndex INT,
@PageSize INT,
@Total INT OUTPUT
AS
BEGIN
WITH Entries AS (
SELECT ROW_NUMBER() OVER (ORDER BY ArtistID asc)
AS Row, Artist, SongCount
FROM artists_table)
SELECT Row, Artist, SongCount
FROM Entries
WHERE Row between
(@PageIndex - 1) * @PageSize + 1 and @PageIndex*@PageSize
-----------------THIS ONE TO GET TOTAL RECORD COUNT AND I HAVE NO IDE HOW
IT SHOULD WORK---------------------
Select @total=Count(ArtistID) from (Select ArtistID From Entries e group by
e.ArtistID) b;
END
___________________________________________________
and this is the asp page that i am usign to get record set
___________________________________________________
<%
objConn ="Provider=SQLOLEDB.1;" & _
"Data Source=MYSERVER;" & _
"Initial Catalog=MYdb;" & _
"User ID=MYID;" & _
"Password=MYPW"
Set objRS = Server.CreateObject("ADODB.Recordset")
strSQL = "page_all_artists " & startFrom & "," & perPage
objRS.Open strSQL, objConn
Do While Not objRS.EOF %>
<%=objRS("Artist")%>
<%
objRS.MoveNext
Loop
objRS.Close
Set objRS=Nothing
Set objConn=Nothing
%>
________________________________________________________________
can somebody show me how can i get @Total value in to my asp code so i can
calculate paging.
Thanks in advance
far i learned creating SPs etc but couldnt workout how to get return value
from my prodecure
my sp as follows
________________________
CREATE PROCEDURE [dbo].[page_all_artists]
@PageIndex INT,
@PageSize INT,
@Total INT OUTPUT
AS
BEGIN
WITH Entries AS (
SELECT ROW_NUMBER() OVER (ORDER BY ArtistID asc)
AS Row, Artist, SongCount
FROM artists_table)
SELECT Row, Artist, SongCount
FROM Entries
WHERE Row between
(@PageIndex - 1) * @PageSize + 1 and @PageIndex*@PageSize
-----------------THIS ONE TO GET TOTAL RECORD COUNT AND I HAVE NO IDE HOW
IT SHOULD WORK---------------------
Select @total=Count(ArtistID) from (Select ArtistID From Entries e group by
e.ArtistID) b;
END
___________________________________________________
and this is the asp page that i am usign to get record set
___________________________________________________
<%
objConn ="Provider=SQLOLEDB.1;" & _
"Data Source=MYSERVER;" & _
"Initial Catalog=MYdb;" & _
"User ID=MYID;" & _
"Password=MYPW"
Set objRS = Server.CreateObject("ADODB.Recordset")
strSQL = "page_all_artists " & startFrom & "," & perPage
objRS.Open strSQL, objConn
Do While Not objRS.EOF %>
<%=objRS("Artist")%>
<%
objRS.MoveNext
Loop
objRS.Close
Set objRS=Nothing
Set objConn=Nothing
%>
________________________________________________________________
can somebody show me how can i get @Total value in to my asp code so i can
calculate paging.
Thanks in advance