First, you can't cast to SqlDbType.Int or SqlDbType.NVarc har. SqlDbType is
an enumeration. Thus, SqlDbType.Int is a value, not a type.
If I understand what you're trying to do, I think you have an object
(presumably of a known type) that you would like to convert into the
equivalent type in the System.Data.Sql Types namespace. This can be done
since all of the types in the System.Data.Sql Types namespace have
constructors that have parameters that take the appropriate type in the
System namespace. For example, SqlInt32 takes an Int32 object as a
parameter. Note that these types do not correspond exactly with the
SqlDbType enumeration. For example when SqlDbType.NVarC har and
SqlDbType.VarCh ar are used, the appropriate type to use from the
System.Data.Sql Types namespace is SqlString.
Hope this helps.
--
Ben Lucas
Lead Developer
Solien Technology, Inc.
www.solien.com
"studen77" <st******@discu ssions.microsof t.com> wrote in message
news:7E******** *************** ***********@mic rosoft.com...
Thanks to anyone in advance who can help :)
Ok, I know this is a far stretch, but what I'm trying to do is to cast a
System.object as one of the SqlDbType enumerations (SqlDbType.Int,
-.NVarchar, etc.) Is this anyway possible? Through inheritance, or
anything?