
Feb 9th, 2007, 05:26 AM
#1
Thread Starter
New Member
How to formulate an expression for a calculated datatable column
I an writing an application with an untyped dataset. The dataset has 3 tables.
Two of the tables will have 5 columns and only one row. They contain numeric data that I will use in the third table to perform some calculations.
Table three will have 10 columns and as many as 20 rows. Five of the columns of Table3 contain numeric data entered by the user and 5 of the columns will hold calculated data. If no parentchild relationship exists between the tables is there a way to code the expression for the calculated columns to reference columns in the other two tables.
I've tried using Table1.ColumnName * Table3ColumnName but this won't complie.
Can anyone give me any suggestions?

Feb 9th, 2007, 05:30 AM
#2
New Member
Re: How to formulate an expression for a calculated datatable column
what sort of calculations?
maybe... poll the fields you need, perform calculations, combine w/user data, and then update table 3?

Feb 9th, 2007, 05:36 AM
#3
Thread Starter
New Member
Re: How to formulate an expression for a calculated datatable column
I suppose my question is this: Is it necessary to establish a relationship between the tables to reference columns from other two tables in the expression used to calculate a column value in the third table.

Feb 9th, 2007, 05:54 AM
#4
Hyperactive Member
Re: How to formulate an expression for a calculated datatable column
Originally Posted by danhollier
I suppose my question is this: Is it necessary to establish a relationship between the tables to reference columns from other two tables in the expression used to calculate a column value in the third table.
No; you use relationships to enforce referential integrity.

Feb 9th, 2007, 11:10 AM
#5
Thread Starter
New Member
Re: How to formulate an expression for a calculated datatable column
Then if it is not necessary to have a parentchild relationship with the tables, what would be the correct syntax of the expression for a calculated column in table3 that does the following:
Table2.Column1Value * Table3.Column3Value
This would be the expression to calculate the value in Table3's Column5

Feb 9th, 2007, 11:17 AM
#6
Hyperactive Member
Re: How to formulate an expression for a calculated datatable column
Originally Posted by danhollier
Then if it is not necessary to have a parentchild relationship with the tables, what would be the correct syntax of the expression for a calculated column in table3 that does the following:
Table2.Column1Value * Table3.Column3Value
This would be the expression to calculate the value in Table3's Column5
That would depend on what DBMS you are using...SQL Server, Oracle, MySQL, what?

Feb 9th, 2007, 12:04 PM
#7
Thread Starter
New Member
Re: How to formulate an expression for a calculated datatable column
The dataset will be untyped. Not connected to any DB backend. I'm using the DataSet instead of an ArrayList to make persisting the data to disk easier. I'll be using the write/read XML of the dataset to do this. I'm new to VB.Net, I'm more familiar with Delphi. Also is there a way to do more complex math calculations in an event of the datatable.

Feb 12th, 2007, 04:39 AM
#8
Hyperactive Member
Re: How to formulate an expression for a calculated datatable column
Originally Posted by danhollier
The dataset will be untyped. Not connected to any DB backend. I'm using the DataSet instead of an ArrayList to make persisting the data to disk easier. I'll be using the write/read XML of the dataset to do this. I'm new to VB.Net, I'm more familiar with Delphi. Also is there a way to do more complex math calculations in an event of the datatable.
Sorry, I can't help you with that; I don't use VB.NET. Since you're not actually using a database I'd suggest you ask this question in the VB.NET forum.
Posting Permissions
 You may not post new threads
 You may not post replies
 You may not post attachments
 You may not edit your posts

Forum Rules

Click Here to Expand Forum to Full Width
Survey posted by VBForums.
