im using a stored procedure to load a number of galleries and then photos within the gallery, however when linking them to the listView only the first two photos are returned.
Stored procedure
ALTER PROCEDURE dbo.test
AS
declare @galID int
Declare c Cursor For Select Distinct gallery_id From galleries
Open c
Fetch next From c into @galID
While @@Fetch_Status = 0 Begin
select top(2) photo_id, photo_name from photos where gallery_id = @galID
Fetch next From c into @galID
End
Close c
Deallocate c
RETURN
result of executing the stored procedure
photo_id photo_name
----------- --------------------------
244 208500_1850052766985_1110
247 260531_2042291492833_1110
No rows affected.
(2 row(s) returned)
photo_id photo_name
----------- --------------------------
279 DSC00281
280 DSC00285
No rows affected.
(2 row(s) returned)
photo_id photo_name
----------- --------------------------
281 Matt relo-MAT
No rows affected.
(1 row(s) returned)
@RETURN_VALUE = 0
Finished running [dbo].[test].
binding to listview
using (api_gallery_dataDataContext apiPic = new api_gallery_dataDataContext())
{
var PhotoResult = from p in apiPic.test()
select new
{
p.photo_id,
p.photo_name
};
ListView3.DataSource = PhotoResult;
ListView3.DataBind(); //bind items to the listview
}
The stored procedure is executing but not all items are binding to the listview. Anyone have any ideas to why this is?