I am working on an app where I require the use of dynamic members. In my app, I have the query customer that has several fields I want to be able to pull data from. Ideally I could do this statically, but I will need to use some of my previous classes to add more queries. So that is why I decided to do this in a dynamic fashion.
To give you some idea of what I am talking about.
In my code I have the arrayList dataCol that I want to populate with data. Statically I would do something like this if I wanted to add the data from the first name column.
dataCol.Add(customer.FirstName.GetValue().ToString());
But since I need to do this in a dynamic fashion, I have created a seperate ArrayList that holds all the column names of my database. To give an example, the columnName FirstName is inside the array.
Here is a bit more code. fldArr is the ArrayList that holds the names of the columns, qbFld is a string variable that holds the name of the column.
So my main question is, how do I take the data from fldArr and replace FirstName with the data?
Any help with this would be greatly appreciated.
for (int k = 0; k < fldArr.Count; k++)
{
if (customer != null)
{
string qbFld = fldArr[k].ToString();
dataCol.Add(customer.FirstName.GetValue().ToString());
}
}
To give you some idea of what I am talking about.
In my code I have the arrayList dataCol that I want to populate with data. Statically I would do something like this if I wanted to add the data from the first name column.
dataCol.Add(customer.FirstName.GetValue().ToString());
But since I need to do this in a dynamic fashion, I have created a seperate ArrayList that holds all the column names of my database. To give an example, the columnName FirstName is inside the array.
Here is a bit more code. fldArr is the ArrayList that holds the names of the columns, qbFld is a string variable that holds the name of the column.
So my main question is, how do I take the data from fldArr and replace FirstName with the data?
Any help with this would be greatly appreciated.
for (int k = 0; k < fldArr.Count; k++)
{
if (customer != null)
{
string qbFld = fldArr[k].ToString();
dataCol.Add(customer.FirstName.GetValue().ToString());
}
}