Jerigho

Jerigho

  • NA
  • 2
  • 0

Insert excel formula for a dataColumn based on two dataColumns

May 29 2008 6:10 AM
Hello,

I need to export a xls and insert 3 columns allowing the user to insert values in 2 of them and show the sum in the third.

I create the columns like this:

        DataColumn dc1 = new DataColumn("Test", System.Type.GetType("System.String"));
     DataColumn dc2 = new DataColumn("Test2", System.Type.GetType("System.String"));
     DataColumn dc = new DataColumn("TestResult", System.Type.GetType("System.String"));

     ds.Tables[0].Columns.Add(dc1);
     ds.Tables[0].Columns.Add(dc2);

     dc.Expression = "Test + Test2";
     ds.Tables[0].Columns.Add(dc);

but I can't find the expression in the xls. This works if using columns already in the dataSet by query to a db, not created by me.

Can anyone help?

tks