 |
| ASP.NET 1.1 As of 10/6/2005, this forum is locked as part of the reorganization described here: http://p2p.wrox.com/topic.asp?TOPIC_ID=35394. No posts have been deleted. Open ongoing discussions from the last week have been moved to either ASP.NET 1.0 and 1.1 Beginners http://p2p.wrox.com/asp-net-1-0-1-1-basics-60/ or ASP.NET 1.0 and 1.1 Professional. http://p2p.wrox.com/forum.asp?FORUM_ID=50. See my sticky post inside for more. |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the ASP.NET 1.1 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|
|

March 22nd, 2004, 03:28 PM
|
|
Authorized User
|
|
Join Date: Jan 2004
Posts: 66
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
calculations using data extracted from a database
hi,
i have a problem which i could use guidance to solve, please?!
i would like to extract a series of values from a database and then multiply them individual figures which are put into the system by users.
At the moment, I can extract the figures i want from the database by using the SQL query:
Select Values
From table
Where ((Value_ID = '1') OR (Value_ID='2') Or (Value_ID='3') Or (Value_ID='4') Or (Value_ID='5'));
this query should return the values of 10, 9, 8, 7, 6.
Is it possible to extract these values from the database and multiply them like so:
database values x user input
10 x 20
9 x 30
8 x 40
7 x 50
6 x 60
I am not to sure how to approach this problem. Any ideas or sample code where this has been done before would be great
Thanks
Morris
|
|

March 22nd, 2004, 03:46 PM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 1,998
Thanks: 0
Thanked 3 Times in 3 Posts
|
|
You could use ADO.NET to multiply the values then post the results back through an update statement using the SQL data adapter. You could also handle this in the database
update Table set Value = Value X Multiplier where Value_ID in ('1', etc).
What database are you using?
|
|

March 22nd, 2004, 05:25 PM
|
|
Authorized User
|
|
Join Date: Jan 2004
Posts: 66
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
hi,
i am using access 2002.
the thing s, i dont want to store the results back in the database - I want to leave the data unchanged while displaying the results of the calculations to the user via a web form of some type.
thanks for your help
Morris
|
|

March 22nd, 2004, 07:37 PM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 1,998
Thanks: 0
Thanked 3 Times in 3 Posts
|
|
In ADO.NET, you could create a custom data column that stores this field. That may be what you want to do. Add a DataColumn to your DataSet's table, and store the calculation there. Then use a control to do the data binding, which this value will be present.
Does that sound on the right track?
|
|

March 29th, 2004, 09:04 AM
|
|
Registered User
|
|
Join Date: Mar 2004
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
If you are using .Net why not bind the data to a datagrid and then us Container.DataItem("Value") to return the value of the field from your database to the page and then do the calculation on the page?
Andy Hodges
|
|

April 1st, 2004, 03:19 PM
|
|
Authorized User
|
|
Join Date: Jan 2004
Posts: 66
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Hi folks, sorry for taking so long to get back to you - very sorry.
Thanks for your suggestions - they were much appreciated. I think I have this problem solved, maybe, hopefully... ill get back to you on your suggestions if it turns out that my work is not right! At this point, anyone who read any of my previous posts will know that tomorrow morning ill probably be back begging for help!!
Thanks again,
Morris
|
Similar Threads
|
| Thread |
Thread Starter |
Forum |
Replies |
Last Post |
| Chapter 4 calculations |
zenixcomp |
BOOK: Beginning PHP5, Apache, and MySQL Web Development ISBN: 978-0-7645-7966-0 |
0 |
November 3rd, 2008 05:18 PM |
| DatePart Calculations |
ninel |
SQL Language |
2 |
February 29th, 2008 03:08 AM |
| Date Calculations |
scourge |
SQL Server 2000 |
9 |
May 11th, 2006 05:08 AM |
| Date Calculations |
Stu_morris40 |
Infopath |
0 |
November 1st, 2005 11:53 AM |
| DateTime calculations |
sudarshan73 |
SQL Server 2000 |
1 |
March 15th, 2005 03:13 PM |
|
 |