Click here to Skip to main content
15,919,358 members

Comments by Member 4373780 (Top 1 by date)

Member 4373780 11-Mar-14 9:08am View    
You are right but I want to store those values using following,
foreach (var grp in query)
{
DataRow dr = dtMainChartData.NewRow();
dr["KeyColumn"] = grp.KeyColumn;
dr["Total"] = grp.Total;
dtMainChartData.Rows.Add(dr);
}

Here how can I set data type of data type of data column as dynamic. Here I have set data type of data column accordingly Data type of SQL in runtime like,

KeyColumnDataType = dtDrillDownChartData.Columns[0].DataType.FullName;
TotalDataType = dtDrillDownChartData.Columns[2].DataType.FullName;

dtMainChartData.Columns.Add("KeyColumn", System.Type.GetType(KeyColumnDataType));
dtMainChartData.Columns.Add("Total", System.Type.GetType(TotalDataType));