System.Currency inaccessible

  • Thread starter Thread starter Octavio Hernandez
  • Start date Start date
O

Octavio Hernandez

Hi,

I have a seemingly easy problem drivin' me nuts. I'd be grateful for any
hint on what may be causing it.
The fact is I'm developing an ASP.NET web site.
At some point, I need to read a money amount from a DataReader. The line is:

if (reader.Read())
{
Currency c1 = (Currency) reader[0]; // OFFENDING LINE
txtAmount.Text = c1.ToString();
// ...
}

The compiler complains that 'System.Currency is inaccessible due to its
protection level'.
If I remove this line and the one below, source compiles fine.

Txs and regards - Octavio
 
Octavio Hernandez said:
I have a seemingly easy problem drivin' me nuts. I'd be grateful for any
hint on what may be causing it.
The fact is I'm developing an ASP.NET web site.
At some point, I need to read a money amount from a DataReader. The line is:

if (reader.Read())
{
Currency c1 = (Currency) reader[0]; // OFFENDING LINE
txtAmount.Text = c1.ToString();
// ...
}

The compiler complains that 'System.Currency is inaccessible due to its
protection level'.
If I remove this line and the one below, source compiles fine.

System.Currency is a class internal to mscorlib - you can't use it.
 
Thanks Jon!

Just after posting I realized what I wanted was no Currency, but Decimal.
The Delphi past betrays me sometimes :-)

Regards - Octavio



Jon Skeet said:
Octavio Hernandez said:
I have a seemingly easy problem drivin' me nuts. I'd be grateful for any
hint on what may be causing it.
The fact is I'm developing an ASP.NET web site.
At some point, I need to read a money amount from a DataReader. The line
is:

if (reader.Read())
{
Currency c1 = (Currency) reader[0]; // OFFENDING LINE
txtAmount.Text = c1.ToString();
// ...
}

The compiler complains that 'System.Currency is inaccessible due to its
protection level'.
If I remove this line and the one below, source compiles fine.

System.Currency is a class internal to mscorlib - you can't use it.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top