DataRow column type and RDBMS

  • Thread starter Thread starter Edward Diener
  • Start date Start date
E

Edward Diener

For a given RDBMS, Oracle in my case, how do I tell what actual .NET type a
DataRow column returns beyond the generic System.Object reference ?
 
Miha Markic said:
Hi Edward,

DataRow's table DataColumn has DataType param.

I understand that but am trying to find out beforehand how a particular
RDBMS's data types match to .NET built-in data types when column values are
being accessed in general. Just as a random example, what does Oracle's
NUMBER data type translate to in .NET, etc. Where would such information be
found ? I imagine how this works depends on the driver being used, so
perhaps I am actually looking for information for a particular driver.
--
Miha Markic [MVP C#] - RightHand .NET consulting & development
SLODUG - Slovene Developer Users Group
www.rthand.com

Edward Diener said:
For a given RDBMS, Oracle in my case, how do I tell what actual .NET type
a
DataRow column returns beyond the generic System.Object reference ?
 
Hi Edward,

I don't remember seeing this feature available (to public).
I guess it depends on the provider if it exposes this feature.

--
Miha Markic [MVP C#] - RightHand .NET consulting & development
SLODUG - Slovene Developer Users Group
www.rthand.com

Edward Diener said:
Miha Markic said:
Hi Edward,

DataRow's table DataColumn has DataType param.

I understand that but am trying to find out beforehand how a particular
RDBMS's data types match to .NET built-in data types when column values
are
being accessed in general. Just as a random example, what does Oracle's
NUMBER data type translate to in .NET, etc. Where would such information
be
found ? I imagine how this works depends on the driver being used, so
perhaps I am actually looking for information for a particular driver.
--
Miha Markic [MVP C#] - RightHand .NET consulting & development
SLODUG - Slovene Developer Users Group
www.rthand.com

Edward Diener said:
For a given RDBMS, Oracle in my case, how do I tell what actual .NET type
a
DataRow column returns beyond the generic System.Object reference ?
 
Without this "feature" are you saying that one should always test the
DataColumn's datatype before casting the object returned from
DataRow["ColumnName..."] to the correct type ? That sounds like overkill.
Surely there must be some documentation which says, for a given RDBMS or
provider, what the equivalent .NET datatype is for a database type so that
the programmer understands what .NET types hold database row values. For
instance, for the SQL server provider, is there really no documentation of
the equivalence between SQL Server data types and .NET data types ? If there
is such documentation, where is it usually kept ? If there is not you are
basically saying that all ADO .NET programming needs to test all possible
values for a DataColumn's datatype, using a big switch statement, for a
particular DataColumn in a particular table, in order to put that value into
a variable of the the correct .NET type ( other than object ). Somehow I
feel that this can not be right and that good ADO .NET programming can find
out the .NET datatype which should be used for storing a row's value prior
to writing code.

Miha Markic said:
Hi Edward,

I don't remember seeing this feature available (to public).
I guess it depends on the provider if it exposes this feature.

--
Miha Markic [MVP C#] - RightHand .NET consulting & development
SLODUG - Slovene Developer Users Group
www.rthand.com

Edward Diener said:
Miha Markic said:
Hi Edward,

DataRow's table DataColumn has DataType param.

I understand that but am trying to find out beforehand how a particular
RDBMS's data types match to .NET built-in data types when column values
are
being accessed in general. Just as a random example, what does Oracle's
NUMBER data type translate to in .NET, etc. Where would such information
be
found ? I imagine how this works depends on the driver being used, so
perhaps I am actually looking for information for a particular driver.
--
Miha Markic [MVP C#] - RightHand .NET consulting & development
SLODUG - Slovene Developer Users Group
www.rthand.com

For a given RDBMS, Oracle in my case, how do I tell what actual .NET type
a
DataRow column returns beyond the generic System.Object reference ?
 
Back
Top