Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
V.F.P. oledb
Message
From
16/03/2006 20:11:44
Cindy Winegarden
Duke University Medical Center
Durham, North Carolina, United States
 
 
To
14/03/2006 15:28:02
General information
Forum:
ASP.NET
Category:
ADO.NET
Title:
Miscellaneous
Thread ID:
01104360
Message ID:
01105164
Views:
19
>"The provider could not determine the Decimal value".

Hi Paul,

I just came across a similar thread: http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=247082&SiteID=1

"You use a Int32 while is is a Decimal i gues, what kind of type's are in it? You can call GetType to check it. Cast the data to you needed type."

Here is your (the poster to that thread) manipulated code:

OleDbDataReader myReader;
try
{
 myReader = myCommand.ExecuteReader();
 while (myReader.Read())
 {
  if( myReader[0] != DBNull.Value )
  {
   String message = String.Format( "{0}, {1}", (Decimal)myReader[0], (String)myReader[1] );
   Console.WriteLine( message );
  }
  else
  {
   Console.WriteLine( "Null value found." );
  }
 }
 // always call Close when done reading.
 myReader.Close();
 OleDbDataReader myReader;
 myReader = myCommand.ExecuteReader();
 while (myReader.Read())
 {
  if( myReader[0] != DBNull.Value )
  {
   String message = String.Format( "{0}, {1}", (Decimal)myReader[0], (String)myReader[1] );
   Console.WriteLine( message );
  }
  else
  {
   Console.WriteLine( "Null value found." );
  }
 }
}
finally
{
 // always call Close when done reading.
 if( myReader != null )
 {
  myReader.Close();
 }
}
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform