Re: NEWBIE: RecordCount of SqlDataSource
From: Daan (daan_at_nergens.com)
Date: 07/23/04
- Next message: josh_sivey: "Re: [MissingFieldException: Field not found:"
- Previous message: John Hoge: "Re: Server.UrlDecode from console application"
- In reply to: Cowboy \(Gregory A. Beamer\) [MVP]: "Re: NEWBIE: RecordCount of SqlDataSource"
- Messages sorted by: [ date ] [ thread ]
Date: Fri, 23 Jul 2004 16:57:01 +0200
Hi!
Does anyone know how to extract the DataSet from a SqlDataSource?
(I have really been searching and trying, but I can't figger it out -> a
real newbie?)
Thanks!
Daan
"Cowboy (Gregory A. Beamer) [MVP]" <NoSpamMgbworld@comcast.netNoSpamM>
schreef in bericht news:%231cgHrLcEHA.1656@TK2MSFTNGP09.phx.gbl...
> You should be able to extract the DataSet and pull the number out (would
> give you code, but I do not have the 2.0 machine up and running). As far
as
> how to embed the number in a page, you have two choices.
>
> 1. Add a label and set the Text property
> 2. Use data binding <%# =variableName %> - just set the variableName in
the
> back and make sure it is accessible. You will have to run Page.DataBind()
to
> ensure it is bound, however.
>
> --
> Gregory A. Beamer
> MVP; MCP: +I, SE, SD, DBA
>
> ************************************************
> Think Outside the Box!
> ************************************************
> "Daan" <daan@nergens.com> wrote in message
> news:cdql5b$uat$1@news.cistron.nl...
> > Hi!
> >
> > I have this SqlSataSource (aspx 2.0):
> >
> > <asp:SqlDataSource ID="ArtiestenSource" Runat="server"
> > SelectCommand="SELECT lower(artiest) AS artiest, COUNT(DISTINCT album)
AS
> > albums, COUNT(artiest) AS tracks, SUM(seconden) AS seconden,
> > CONVERT(varchar, DATEADD(second, SUM(seconden), ''), 108) AS Duur FROM
> > dbo.muziek GROUP BY artiest"
> > ConnectionString="Server=DESERVER;User
> > ID=sa;Password=wachtwoord;Database=Muziek;Persist Security Info=True"
> > ProviderName="System.Data.SqlClient">
> > </asp:SqlDataSource>
> >
> > Maybe someone knows how to retrieve the number of rows of this
datasource?
> > (ArtiestenSource.RecordCount doesn't work. )
> >
> > Also: I would display this number of rows like this:
> > <% response.write(ArtiestenSource.RecordCount) %>
> >
> > But I don't doubt there is a typical dot net 2.0 way of displaying this
> > result. (So, something else then <% response.write() %>.
> > If I am right about that, does someone know what right way is?
> >
> > Thanks!
> >
> > Daan
> >
> >
>
>
- Next message: josh_sivey: "Re: [MissingFieldException: Field not found:"
- Previous message: John Hoge: "Re: Server.UrlDecode from console application"
- In reply to: Cowboy \(Gregory A. Beamer\) [MVP]: "Re: NEWBIE: RecordCount of SqlDataSource"
- Messages sorted by: [ date ] [ thread ]