Forums
This topic is locked
Recordset Dissappears when using sum function!
Posted 22 Nov 2006 15:33:13
1
has voted
22 Nov 2006 15:33:13 Kelvin Pharaoh posted:
Hi , I've run into a problem using DW8 , VBScript, SQL Server 7.0; that has got me totally buffled! This query is to add up all the total cost of the items in a shopping cart:
SELECT sum (dbo.product.prodprice)
FROM dbo.cart,dbo.product
WHERE dbo.cart.username='varUsername' AND dbo.cart.prodID=dbo.product.prodID AND dbo.cart.orderID=''
I create the recordset called Rstotal and then under advanced query mode , enter the above SQL and Add the variable, Name: varUsername , Default Value: KWP , Runtime Value: Session("MM_Username"
I click the test button and it works as expected , i.e. the query returns the total of the products for the specified User. However this is where it falls down; instead receiving a lighting bolt under the Rstotal recordset in the DW8 binding pane, with prodprice or something similar; which would allow me to drag the item onto the page, DW8 gives me a lighting bolt with a blank name which I am unable to drag.
This only happens when I add the sum or any other mathematical function i.e. AVG to the SQL; if I don't add the sum function then it gives me the prodprice item under the binding pane , which obviously doen't help because I need the total cost of all the items in the cart for a specified user.
Please help this is driving me crazy!
Many Thanks in Advance.
Kelvin
Replies
Replied 22 Nov 2006 16:15:31
22 Nov 2006 16:15:31 Vince Baker replied:
you need to give the result of the sum a name for it to be displayed in the server box.
change it to SELECT sum(dbo.product.prodprice) AS sum_of_price
That should do it
Regards
Vince Baker
<strong>DMX Zone Manager</strong>
[VBScript | ASP | HTML | CSS | SQL | Oracle | AS400 | ERP Logic | Hosting]
change it to SELECT sum(dbo.product.prodprice) AS sum_of_price
That should do it
Regards
Vince Baker
<strong>DMX Zone Manager</strong>
[VBScript | ASP | HTML | CSS | SQL | Oracle | AS400 | ERP Logic | Hosting]
Replied 22 Nov 2006 17:21:25
22 Nov 2006 17:21:25 Kelvin Pharaoh replied:
Thanks Vince, it works perfectly. 8D
<BLOCKQUOTE id=quote><font size=1 face="Verdana, Arial, Helvetica" id=quote>quote:<hr height=1 noshade id=quote>
you need to give the result of the sum a name for it to be displayed in the server box.
change it to SELECT sum(dbo.product.prodprice) AS sum_of_price
That should do it
Regards
Vince Baker
<strong>DMX Zone Manager</strong>
[VBScript | ASP | HTML | CSS | SQL | Oracle | AS400 | ERP Logic | Hosting]
<hr height=1 noshade id=quote></BLOCKQUOTE id=quote></font id=quote><font face="Verdana, Arial, Helvetica" size=2 id=quote>
<BLOCKQUOTE id=quote><font size=1 face="Verdana, Arial, Helvetica" id=quote>quote:<hr height=1 noshade id=quote>
you need to give the result of the sum a name for it to be displayed in the server box.
change it to SELECT sum(dbo.product.prodprice) AS sum_of_price
That should do it
Regards
Vince Baker
<strong>DMX Zone Manager</strong>
[VBScript | ASP | HTML | CSS | SQL | Oracle | AS400 | ERP Logic | Hosting]
<hr height=1 noshade id=quote></BLOCKQUOTE id=quote></font id=quote><font face="Verdana, Arial, Helvetica" size=2 id=quote>