Visualizzazione dei risultati da 1 a 3 su 3
  1. #1
    Utente di HTML.it
    Registrato dal
    Jun 2003
    Messaggi
    26

    C# Convert.Tostring(Data)

    Salve a tutti ho un problemino di conversione.
    Stoestraendo una data da un database con GetDate e nel momento in cui tento di convertirla in stringa mi da il seguente errore:

    ERROR sqlLoadCategorie.
    The data value could not be converted for reasons other than sign mismatch or data overflow. For example, the data was corrupted in the data store but the row was still retrievable.

    Perchè non posso convertirla????
    C'è un metodo per farlo o qualcosa che possa sostituirsi?

  2. #2
    se sicuro che l'errore non sia sulla getDate? che db usi?
    se provi ad estrarre la data con GetString riesci a vederla?

  3. #3
    Per convertire una data ti conviene usare questo:

    Convert.ToDateTime(Data).ToShortDateString()

    dove 'Data' è un oggeto generico che ti viene fuori da un dataset.
    = IrCLaB IRC Network CEO =
    contact: irc.irclab.net #irclab
    mail: shardick at irclab dot net

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2024 vBulletin Solutions, Inc. All rights reserved.