I have

SessionData sdc = new SessionData();

And all the properties of sdc are stored in a table in sql server.

I want to retrieve the properties of the sdc dynamically.
And i know

sdc. reader1["xmlname"]=

is a wrong way of doing it. So can any one help me how to proceed.



Thanks for you help but I think i know the ado.net concepts.

As I said earlier the properties of sdc are in in the database.

for ex:

sdc.IsSkySports = chkSportsTV.Checked;
   sdc.IsPremiumMovies = chkMoviesTV.Checked;
 sdc.IsRecordableBox = chkRecordableBox.Checked;

In my case


are saved in the database table ...

And i have to acess then dynamically...

I have written the stored procedures and everything...but i dont know the c# syntax to get those from the database and apply it as properties of the object sdc..

Please help..This is really urgent

Thanks in Advance

the properties value of your object are stored in your database?

yes..even the values are stored...but for now i want to access the properties....

so basically the resultset of your query contains the propertyname you want to access then use it with your object.

you can use System.Reflection.PropertyInfo

string propName = YourDataReader.GetString(GetOrdinal("PropertyName", dr))

PropertyInfo info = YourObject.GetType().GetProperty(propName);

for getting of the property value
object obj = info.GetValue(YourObject, null);

for setting of the property value
object obj = info.SetValue(YourObject, YourValue, null);

here is a link for Reflection:

Thanks a lot..It helped..