How to GetDecimal from database by ColumnName (NOT: by column number) ?



Normally I retrieve an (e.g. DECIMAL) value from a database record by enumerating
the column number like:

Decimal localvar = reader.GetDecimal(3);

Which means "Get the decimal value from the 3rd column in the database record".

However is there a way to tell CSharp to retrieve the Decimal value from
the column named "MYAMOUNT" ?

I could imagine that it works similar to:

Decimal localvar = reader.GetDecimal(GetColumnNumberFor("MYAMOUNT"));

Marl

.



Relevant Pages

  • Validating / enumerating ISO currency symbols
    ... is there a method to validate a given 3-letter ISO currency code, eg AUD,USD ... etc and retrieve associated data such as symbol and # of decimals? ... Or a way of enumerating thru the known set of these would be good enough. ... can only see these features via a culture, ...
    (microsoft.public.dotnet.framework)
  • Re: Retrieving data from Oracle
    ... to retrieve the data through fetchrow_array. ... but they are uppercase or mixed case. ... Try enumerating all hash keys of your hashref. ...
    (perl.dbi.users)