How to apply expression in data table?

Treefrog

New Member
\[code\]System.IO.StreamReader rdr = new StreamReader(csvPath.Text); DataTable dt = new DataTable("Table"); dt.Columns.Add(new DataColumn("Date")); dt.Columns.Add(new DataColumn("A.TEMP090835")); dt.Columns.Add(new DataColumn("Difference")); while ((rowValue = http://stackoverflow.com/questions/12596256/rdr.ReadLine()) != null) { string[] arr; arr = rowValue.Split(','); DataRow row = dt.NewRow(); row["Date"] = arr[0]; row["A.TEMP090835"] = arr[4]; row["Difference"] = //here is the problem dt.Rows.Add(row); } dt.Rows.RemoveAt(0); dataGridView2.DataSource = dt; rdr.Close();\[/code\]This code makes a data table with 3 columns.....Date, A.TEMP... and Difference. The csv file I'm importing the data from does not have the 3rd column which is "Difference". I need to write an expression for that column.....the logic for which can be understood through the following csv file: Date, A.TEMP090835, Difference10/28/2011, 25.56, 010/28/2011, 26.65, 26.65 - 25.56 10/28/2011, 27.11, 27.11 - 25.5610/28/2011, 29.43, 29.43 - 25.56 10/28/2011, 30.29, 30.29 - 25.5610/28/2011, 31.57, 31.57 - 25.5610/28/2011, 32.82, 32.82 - 25.5610/28/2011, 34.07, 34.07 - 25.56How do I fill the "Diffrence" column ?
 
Back
Top