adding a new column to dataset which stores log values of another table

amanjotsingh

New member
Joined
Mar 4, 2008
Messages
2
Programming Experience
3-5
Hi, I am using dataset for playing with data and wanted to create an additional column that stores logarithm (log) of another column. I tried to use number of options including the one below but still have trouble making the program work.

dtRec.Columns.Add("sumXY", Type.GetType("System.Double"), Math.Log("recflow"))

recflow is an existing column of the dataset and I want log values of reflow to be stored in new sumXY column.

Any suggestions!!

Amanjot
 
FYI: To add a column that is calculated from other columns you must set the Expression property. GOogle for DataColumn.Expression

BUT, you wont succeed with LOG because only a limited set of functions are supported by Expression and log isnt one of them. Create a typed dataset in the designer, and attach an event handler to one of the events that fires when a value in the column youre interested in, changes and then update the Log column from there
 
Thanks for the hint; could you please give an example or suggest some site/reference where I could find a similar example of what you have suggested?

Amanjot
 
Just open your dataset in the designer, and look at the events available on the table you want to use
 
Back
Top