Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
V.F.P. oledb
Message
De
16/03/2006 20:11:44
Cindy Winegarden
Duke University Medical Center
Durham, Caroline du Nord, États-Unis
 
 
À
14/03/2006 15:28:02
Information générale
Forum:
ASP.NET
Catégorie:
ADO.NET
Titre:
Divers
Thread ID:
01104360
Message ID:
01105164
Vues:
17
>"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();
 }
}
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform