FacebookTwitter
Hatrack River Forum   
my profile login | search | faq | forum home

  next oldest topic   next newest topic
» Hatrack River Forum » Active Forums » Books, Films, Food and Culture » ASP .net compute method

   
Author Topic: ASP .net compute method
Blayne Bradley
unregistered


 - posted            Edit/Delete Post 
code:
lblTotal.Text = gt.Compute("SUM(QuantityOrdered)", "QuantityOrdered Is Like'" & ddlPr_Name.SelectedValue & "'")

Basically I wanna sum up all the values in a datatable corresponding only for a certain column.
IP: Logged | Report this post to a Moderator
TomDavidson
Member
Member # 124

 - posted      Profile for TomDavidson   Email TomDavidson         Edit/Delete Post 
And...?

(Edit: look at your code, Blayne.)

Posts: 37449 | Registered: May 1999  |  IP: Logged | Report this post to a Moderator
Blayne Bradley
unregistered


 - posted            Edit/Delete Post 
the command as is, and varitions of it playing with syntax gives me an error

"Cannot perform 'Like' operation on System.Int32 and System.String."

IP: Logged | Report this post to a Moderator
TomDavidson
Member
Member # 124

 - posted      Profile for TomDavidson   Email TomDavidson         Edit/Delete Post 
You have two problems with this code.
First off, QuantityOrdered is almost certainly an Integer field; you can't use "is like" operators on an Integer. Secondly, you're checking the QuantityOrdered column against the SelectedValue property of the ddlPr_Name field, which is probably a dropdown list of products.

My guess is that you want to sum the QuantityOrdered field across only (and all) the records that correspond to the ProductID of the item selected from the dropdown, which is the SelectedValue of ddlPr_Name.

If that's the case, what you really want is....

Okay, wait. You figure the rest out.

Posts: 37449 | Registered: May 1999  |  IP: Logged | Report this post to a Moderator
Lisa
Member
Member # 8384

 - posted      Profile for Lisa   Email Lisa         Edit/Delete Post 
So... the old rule about not helping people with homework has been repealed? Cool.
Posts: 12266 | Registered: Jul 2005  |  IP: Logged | Report this post to a Moderator
TomDavidson
Member
Member # 124

 - posted      Profile for TomDavidson   Email TomDavidson         Edit/Delete Post 
I've never considered it a rule, and certainly never let it bind me.
Posts: 37449 | Registered: May 1999  |  IP: Logged | Report this post to a Moderator
Blayne Bradley
unregistered


 - posted            Edit/Delete Post 
code:
lblTotal.Text = gt.Compute("SUM(QuantityOrdered)", "ProductName Like '" & ddlPr_Name.SelectedValue & "'")

Thanks for pointing me in the right direction.
IP: Logged | Report this post to a Moderator
Blayne Bradley
unregistered


 - posted            Edit/Delete Post 
K, if I upload asp files to a linux server, how can I get it to work as a webpage, non homework related I just wanna put my work online so employers can look at it.
IP: Logged | Report this post to a Moderator
MattP
Member
Member # 10495

 - posted      Profile for MattP   Email MattP         Edit/Delete Post 
Um... a Linux server is not going to be able to host asp files unless you just have static HTML content.
Posts: 3275 | Registered: May 2007  |  IP: Logged | Report this post to a Moderator
Nighthawk
Member
Member # 4176

 - posted      Profile for Nighthawk   Email Nighthawk         Edit/Delete Post 
I've been told that it can; aren't there ASP and ASP.NET interpreters for Linux already?
Posts: 3486 | Registered: Sep 2002  |  IP: Logged | Report this post to a Moderator
MattP
Member
Member # 10495

 - posted      Profile for MattP   Email MattP         Edit/Delete Post 
Well, there's Mono. I have no experience with it so I can't say what's involved there.
Posts: 3275 | Registered: May 2007  |  IP: Logged | Report this post to a Moderator
Reshpeckobiggle
Member
Member # 8947

 - posted      Profile for Reshpeckobiggle   Email Reshpeckobiggle         Edit/Delete Post 
[Confused]
Posts: 1286 | Registered: Dec 2005  |  IP: Logged | Report this post to a Moderator
TomDavidson
Member
Member # 124

 - posted      Profile for TomDavidson   Email TomDavidson         Edit/Delete Post 
BTW, from a design perspective, you probably don't want to make ProductName the SelectedValue of your dropdownlist. The value should be the ProductID, assuming you have one.
Posts: 37449 | Registered: May 1999  |  IP: Logged | Report this post to a Moderator
   

   Close Topic   Feature Topic   Move Topic   Delete Topic next oldest topic   next newest topic
 - Printer-friendly view of this topic
Hop To:


Contact Us | Hatrack River Home Page

Copyright © 2008 Hatrack River Enterprises Inc. All rights reserved.
Reproduction in whole or in part without permission is prohibited.


Powered by Infopop Corporation
UBB.classic™ 6.7.2