However it is not saving in visual srudio 2005. it is saying 'ambiguous column name ID' does anyone know why?
CREATE PROCEDUREPagedResults_New(
@.startRowIndexint,@.maximumRowsint
)
AS
--Create a table variable
DECLARE@.TempItemsTABLE
(
IDint IDENTITY,ShortListIdint
)
-- Insert the rows from tblItems into the temp. table
INSERT INTO@.TempItems (ShortListId)
SELECTId
FROMShortlist S
WHEREPublish ='True'order by date DESC
-- Now, return the set of paged records
SELECTS.*
FROM@.TempItems tINNER JOINShortList SON
t.ShortListId = S.Id
WHEREIDBETWEEN@.startRowIndexAND(@.startRowIndex + @.maximumRows) - 1
Change:
WHEREIDBETWEEN@.startRowIndexAND(@.startRowIndex + @.maximumRows) - 1
To:WHERET.IDBETWEEN@.startRowIndexAND(@.startRowIndex + @.maximumRows) - 1
|||Thanks. do you know how i would implement paging with this?
|||Thanks. do you know how i would implement paging with this?
It should be very easy to impliment this sp to your application using visual studio. For example ,you can use sqlcommand. Your stored procedure takes two parameters @.startRowIndex and@.maximumRows . First build a sqlcommand and set commond type to stored procedure and command text to your procedure name. Add two parameters(corresponding to @.startRowIndex and@.maximumRows) to your sqlcommand.parameters and call ExecuteReader(). This way you will be able to get the table returned by your stored procedure.
I suggest you reading this:http://msdn2.microsoft.com/en-us/library/system.data.sqlclient.sqlcommand.aspx
Hope my suggestion helps
No comments:
Post a Comment