I'm needing to dynamically convert datatype from a string representation of SqlDbType (like "nchar" for SqlDbType.NChar) to a System.Type in code.
For example, I want to store a System.Type with a based on some value, like:
dim mytype as System.Type
If myvar = "nchar" then mytype = System.Type.GetType("System.String")
I want to then use mytype to convert some piece of data, like:
dim myobject as Object
myobject = CType(somevalue, mytype)
The CType() fails, however, with an excption saying that "Type 'mytype' is not defined."
The app that this applies to is a data conversion app where I'm iterating through rows and columns converting them to another vendors' application.
My question is, can what I'm wanting to do be done?