T
T!LT3D
Hi
I'm trying to convert data automatically from a SqlDataReader into the
correct type for its class property, it goes something like this but is
reported syntactilly incorrect....
MyField = (_sr.GetFieldType(i))_sr.GetValue(i)
....it complains at the second _sr (; expected), is there a nice funky way of
doing this without creating some kind of conversion matrix i.e.....
if _sr.GetFieldType(i) = "aType" MyField = (aType)_sr.GetValue(i)
else if _sr.GetFieldType(i) = "bType" MyField = (bType)_sr.GetValue(i)
else if ......
Any help appreciated.
Chris.
I'm trying to convert data automatically from a SqlDataReader into the
correct type for its class property, it goes something like this but is
reported syntactilly incorrect....
MyField = (_sr.GetFieldType(i))_sr.GetValue(i)
....it complains at the second _sr (; expected), is there a nice funky way of
doing this without creating some kind of conversion matrix i.e.....
if _sr.GetFieldType(i) = "aType" MyField = (aType)_sr.GetValue(i)
else if _sr.GetFieldType(i) = "bType" MyField = (bType)_sr.GetValue(i)
else if ......
Any help appreciated.
Chris.