M
Mike
Stored Procedure:
CREATE PROCEDURE [dbo].[GetBanner]
@BannerPage nvarchar(50),
@MagazineID int
AS
BEGIN
SET NOCOUNT ON;
DECLARE @BannerID int
SELECT TOP 1
@BannerID = BannerID
FROM Banners
WHERE BannerPage=@BannerPage AND MagazineID = @MagazineID
AND StartDate <= GetDate() AND EndDate >=GetDate()
ORDER BY Views
SELECT
BannerID,
BannerFileName,
AltText,
URL,
Views
FROM Banners
WHERE BannerID = @BannerID
UPDATE Banners SET Views = Views +1 WHERE BannerID = @BannerID
UPDATE BannerStats SET Views = Views + 1 WHERE BannerID = @BannerID
END
OnSelected method:
protected void dsBanner_Selected(object sender,
SqlDataSourceStatusEventArgs e)
{
int RecordCount = e.AffectedRows;
Response.Write(RecordCount);
}
This ALWAYS gives me 0 - despite the fact that the correct banner is pulled
from the database, and updated etc. Also, when I execute the procedure (for
valid parameter values) in SSMS, I get "1 row(s) Affected". Can anyone tell
me what I need to change to get the proper value?
Thanks
CREATE PROCEDURE [dbo].[GetBanner]
@BannerPage nvarchar(50),
@MagazineID int
AS
BEGIN
SET NOCOUNT ON;
DECLARE @BannerID int
SELECT TOP 1
@BannerID = BannerID
FROM Banners
WHERE BannerPage=@BannerPage AND MagazineID = @MagazineID
AND StartDate <= GetDate() AND EndDate >=GetDate()
ORDER BY Views
SELECT
BannerID,
BannerFileName,
AltText,
URL,
Views
FROM Banners
WHERE BannerID = @BannerID
UPDATE Banners SET Views = Views +1 WHERE BannerID = @BannerID
UPDATE BannerStats SET Views = Views + 1 WHERE BannerID = @BannerID
END
OnSelected method:
protected void dsBanner_Selected(object sender,
SqlDataSourceStatusEventArgs e)
{
int RecordCount = e.AffectedRows;
Response.Write(RecordCount);
}
This ALWAYS gives me 0 - despite the fact that the correct banner is pulled
from the database, and updated etc. Also, when I execute the procedure (for
valid parameter values) in SSMS, I get "1 row(s) Affected". Can anyone tell
me what I need to change to get the proper value?
Thanks