.NET Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgramming.NET Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old February 20th, 2005, 08:20 AM
summer00 summer00 is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2004
Posts: 17 summer00 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 18 m 14 sec
Reputation Power: 0
DataColumn.Expression Question

Hi there,

I have a DataTable which contains 3 columns ,

column[0] = quantity
column[1] = unit_price
column[2] = total

I have set the column[2].Expression equals to quantity * unit_price, then i compute it .
Code:
DataTable1.Columns["total"].Expression = "quantity*unit_price";
DataTable1.Compute("Sum(total)", "");


Codes above runs without any problem, i was able to calculate the "total" value and store it in the "total" column

The problem is, i would like to sum up the column "total" of the datatable , for instance : the datatable has 3 products, then i want to calculate the sum of the "total" columns. Normally , this could be done using the same code :

Code:
DataTable1.Compute("Sum(total)", "");


but the "total" column's expression has been changed to "quantity*unit_price" previously....hence "Sum(total)" won't work.

I try to assign the "total" column expression back to "total" , but it returns
the Exception:

Code:
Cannot set Expression property due to circular reference in the expression.


Anyone knows how to solve this ? thanks a lot

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgramming.NET Development > DataColumn.Expression Question


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway
Stay green...Green IT