But what would that function return?
You would have to declare the return type as whatever the lower common
denominator is - and that would defeat the purpose of the function. Even if
you CType it inside, if the return type is the ancestor class, then anything
calling the function thinks it is getting an ancestor class. So calling the
function was just a waste of time, really.
If this is not what you are trying to do, then I think the Case statement is
your only solution. But that shouldn't be a problem, since you presumably
want to do something with the object afterwards - but you would have to
already know what type it is during coding to be able to call anything
specific to the type anyway. So it really shouldn't be a problem.
"MikeG" <Mi***@discussions.microsoft.com> wrote in message
news:E6**********************************@microsof t.com...
I am attempting to write a 'factory' function to use in a generated data
access layer to accept a sqldbtype and convert it to the appropriate
system.type.
I have attempted to use ctype (value, typename)
where value is the sqlreader field object and typename is a variable
containing the required type as a system.type and I'm getting nowhere.
Any ideas appreciated.
Thanks in anticipation,
Mike