Ask a Question related to ASP Database, Design and Development.
-
nathan #1
Putting query to good use.
Hey folks, hope you all had a good weekend. Here's this mornings
dilema for me.
I have my query, which when ran in Query Analyzer, gives me back nice
neat little rows with the percentages.
"SELECT fit, count(*) * 100.00/ (select count (*) from internal) as
[Percent] FROM internal GROUP by fit"
gives me...
fit Percent
--------------------------------------------------
----------------------------
Agree 20.000000000000
Disagree 20.000000000000
Neither 20.000000000000
StronglyAgree 40.000000000000
(4 row(s) affected)
I've constructed my recordset in asp, with the above query. My
question is, how do i structure an ASP page to show me the results?
Any pointers in the general direction would be much appreciated.
Thanks for your time gurus!
nathan Guest
-
Good morning or good evening depending upon your location. I want to ask you the most important question of your life. Your joy or sorrow for all eternity depends upon your answer. The question is: Are you saved? It is not a question of how good you
<RonGrossi382872@yahoo.com> wrote in message news:1114393703.900419.199790@f14g2000cwb.googlegroups.com... This is the most important question of... -
Xcart no good, support no good, need good shopping cart!!!
I need a good quality php shopping cart to port to my site, allowing software downloads and book sales. Integrating ease is really important and... -
Ray at #2
Re: Putting query to good use.
<table>
<%
Dim oADO, oRS, sSQL
sSQL = "SELECT fit, count(*) * 100.00/ (select count (*) from internal) as
[Percent] FROM internal GROUP by fit"
Set oADO = Server.CreateObject("ADODB.Connection")
oADO.Open YourConnectionString
Set oRS = oADO.Execute(sSQL)
Do While Not oRS.EOF
%>
<tr>
<td><%=oRS.Fields.Item(0).Value%></td>
<td><%=FormatNumber(oRS.Fields.Item(0).Value, 2, -1)%>%</td>
</tr>
<%
oRS.MoveNext
Loop
oRS.Close : Set oRS = Nothing
oADO.Close : Set oADO = Nothing
%>
After you get that working, take a look at these articles though.
[url]http://www.aspfaq.com/2073[/url] (Part about counting)
[url]http://www.aspfaq.com/2467[/url]
Also, you could/should make that a stored procedure on your server.
Ray at work
"nathan" <n4th4n@hushmail.com> wrote in message
news:908008f8.0310060941.52fdcb77@posting.google.c om...> Hey folks, hope you all had a good weekend. Here's this mornings
> dilema for me.
>
> I have my query, which when ran in Query Analyzer, gives me back nice
> neat little rows with the percentages.
>
> "SELECT fit, count(*) * 100.00/ (select count (*) from internal) as
> [Percent] FROM internal GROUP by fit"
>
> gives me...
>
> fit Percent
> --------------------------------------------------
> ----------------------------
> Agree 20.000000000000
> Disagree 20.000000000000
> Neither 20.000000000000
> StronglyAgree 40.000000000000
>
> (4 row(s) affected)
>
> I've constructed my recordset in asp, with the above query. My
> question is, how do i structure an ASP page to show me the results?
> Any pointers in the general direction would be much appreciated.
>
> Thanks for your time gurus!
Ray at Guest
-
Bob Barrows #3
Re: Putting query to good use.
Actually, I would prefer:
<%
Dim oADO, oRS, sSQL
Dim sHTML
sHTML = "<table><tr><td>"
sSQL = "SELECT fit, count(*) * 100.00/ (select count (*) from internal) as
[Percent] FROM internal GROUP by fit"
Set oADO = Server.CreateObject("ADODB.Connection")
oADO.Open YourConnectionString
Set oRS = oADO.Execute(sSQL)
sHTML = sHTML & oRS.GetString(,,"</td><td>","</td></tr><tr><td>")
oRS.close
set oRS = nothing
oADO.close
set oADO = nothing
sHTML = left(sHTML,len(sHTML) - 8) & "</table>"
%>
<HTML><HEAD></HEAD><BODY>
<%=sHTML%>
</BODY></HTML>
HTH,
Bob Barrows
Ray at <%=sLocation%> wrote:> <table>
> <%
> Dim oADO, oRS, sSQL
>
> sSQL = "SELECT fit, count(*) * 100.00/ (select count (*) from
> internal) as [Percent] FROM internal GROUP by fit"
> Set oADO = Server.CreateObject("ADODB.Connection")
> oADO.Open YourConnectionString
> Set oRS = oADO.Execute(sSQL)
>
> Do While Not oRS.EOF
> %>
> <tr>
> <td><%=oRS.Fields.Item(0).Value%></td>
> <td><%=FormatNumber(oRS.Fields.Item(0).Value, 2, -1)%>%</td>
> </tr>
> <%
> oRS.MoveNext
> Loop
> oRS.Close : Set oRS = Nothing
> oADO.Close : Set oADO = Nothing
> %>
>
> After you get that working, take a look at these articles though.
>
> [url]http://www.aspfaq.com/2073[/url] (Part about counting)
> [url]http://www.aspfaq.com/2467[/url]
>
> Also, you could/should make that a stored procedure on your server.
>
> Ray at work
>
>
>
>
> "nathan" <n4th4n@hushmail.com> wrote in message
> news:908008f8.0310060941.52fdcb77@posting.google.c om...>> Hey folks, hope you all had a good weekend. Here's this mornings
>> dilema for me.
>>
>> I have my query, which when ran in Query Analyzer, gives me back nice
>> neat little rows with the percentages.
>>
>> "SELECT fit, count(*) * 100.00/ (select count (*) from internal) as
>> [Percent] FROM internal GROUP by fit"
>>
>> gives me...
>>
>> fit Percent
>> --------------------------------------------------
>> ----------------------------
>> Agree 20.000000000000
>> Disagree 20.000000000000
>> Neither 20.000000000000
>> StronglyAgree 40.000000000000
>>
>> (4 row(s) affected)
>>
>> I've constructed my recordset in asp, with the above query. My
>> question is, how do i structure an ASP page to show me the results?
>> Any pointers in the general direction would be much appreciated.
>>
>> Thanks for your time gurus!
Bob Barrows Guest
-
Bob Barrows #4
Re: Putting query to good use.
Oops - that was in one of the links - guess I just wasted a few minutes...
Bob Barrows wrote:<snip>> Actually, I would prefer:
>
Bob Barrows Guest
-
Ray at #5
Re: Putting query to good use.
Hey, come on now, I provided the links for that method. :] And I thought
you'd prefer a SP.
Ray at work
"Bob Barrows" <reb01501@NOyahoo.SPAMcom> wrote in message
news:%23VltMUDjDHA.2644@TK2MSFTNGP10.phx.gbl...> Actually, I would prefer:
>
> <%
> Dim oADO, oRS, sSQL
> Dim sHTML
>
> sHTML = "<table><tr><td>"
> sSQL = "SELECT fit, count(*) * 100.00/ (select count (*) from internal) as
> [Percent] FROM internal GROUP by fit"
> Set oADO = Server.CreateObject("ADODB.Connection")
> oADO.Open YourConnectionString
> Set oRS = oADO.Execute(sSQL)
> sHTML = sHTML & oRS.GetString(,,"</td><td>","</td></tr><tr><td>")
> oRS.close
> set oRS = nothing
> oADO.close
> set oADO = nothing
> sHTML = left(sHTML,len(sHTML) - 8) & "</table>"
> %>
> <HTML><HEAD></HEAD><BODY>
> <%=sHTML%>
> </BODY></HTML>
>
> HTH,
> Bob Barrows
>
>
Ray at Guest
-
Bob Barrows #6
Re: Putting query to good use.
Ray at <%=sLocation%> wrote:
Absolutely :-)> ...And I
> thought you'd prefer a SP.
>
Bob Barrows Guest
-
Aaron Bertrand - MVP #7
Re: Putting query to good use.
> Also, you could/should make that a stored procedure on your server.
You can see an incomplete article about that in [url]http://www.aspfaq.com/2201[/url]
Aaron Bertrand - MVP Guest
-
nathan #8
Re: Putting query to good use.
Thanks for the help gentlemen, worked great, and thanks for the articles.
nathan Guest



Reply With Quote

