I have the following code
//^process a aquery and return DataTable
DataTable d t= dbConnect.ProcessQuery(strquery);
Type t = dt.Columns[0].DataType.GetType();
How to create objects of type t that will receive the dt[0][..] ?
I know that dt.Rows[][] will be of type t
I need to create anagrammatically variables of type t
First step is to retrieve the actual type you want to create. Most probably, the name of the type is stored in the database as a String. So you call
Now that you have the actual type you want to instantiate, call
In most cases you would have a common base interface for all types that you would ever use in each scenario:
Now you can call the methods on the interface and they will be executed on the actual type.
Documentation: http://msdn.microsoft.com/en-us/library/wccyzw83.aspx