H
Homer J. Simpson
I have the following stored procedure:
ALTER PROCEDURE [dbo].[spGetQuickNoteCount]
AS
BEGIN
SET NOCOUNT ON;
SELECT COUNT(*) FROM QUICKNOTES
END
....and the following data source in my .aspx file:
<asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="<%$
ConnectionStrings:csToolbar %>"
SelectCommand="spGetQuickNoteCount" SelectCommandType="StoredProcedure">
</asp:SqlDataSource>
Now...how do I go about binding an <asp:label> so it simply displays the
scalar returned by the stored procedure? I've used gridviews and repeaters
in the past, but those were always bound to a data source that returned
recordsets, not just a scalar.
I suppose I could write code in Page_Load() to connect to the database, run
the stored procedure and set the label's .Text property to the value
returned, but that's just adding extra code I'd like to avoid.
I'm sure I've missed something obvious here...
ALTER PROCEDURE [dbo].[spGetQuickNoteCount]
AS
BEGIN
SET NOCOUNT ON;
SELECT COUNT(*) FROM QUICKNOTES
END
....and the following data source in my .aspx file:
<asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="<%$
ConnectionStrings:csToolbar %>"
SelectCommand="spGetQuickNoteCount" SelectCommandType="StoredProcedure">
</asp:SqlDataSource>
Now...how do I go about binding an <asp:label> so it simply displays the
scalar returned by the stored procedure? I've used gridviews and repeaters
in the past, but those were always bound to a data source that returned
recordsets, not just a scalar.
I suppose I could write code in Page_Load() to connect to the database, run
the stored procedure and set the label's .Text property to the value
returned, but that's just adding extra code I'd like to avoid.
I'm sure I've missed something obvious here...