Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
British Date
Message
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Titre:
Divers
Thread ID:
00916962
Message ID:
00917027
Vues:
11
Hi Fred

I tried your code but received the following error when running the program.

FormatException

I have found a work around for now
this.txtDob.Text.Substring(3,2) + "/" + this.txtDob.Text.Substring(0,2) + "/" + this.txtDob.Text.Substring(6,4) ;
I am sure there must be a better way, but it's working.

Thanks for your help.

John

>Unfortunately when writing to a dataset you need to write in American Date.
>You will need to convert your date back to british and store.
>
>DataSet.Tables["MyTable"].Rows[x]["mycolumn"] = Convert.ToDateTime(this.txtDob.Text).ToString("MM/dd/yyyy")
>
>
>>I am storing the current date to a text box with the following code.
>>
>>
>>this.txtDob.Text = System.DateTime.Today.ToString("dd/MM/yyyy") ;
>>
>>
>>I am then trying to save the date into a dataset created from an XML file. When it tries to save this.txtDob.Text I receive the following error.
>>
>>An unhandled exception of type 'System.ArgumentException' occurred in System.Data.dll
>>
>>Additional information: Couldn't store in db Column. Expected type is DateTime.
>>
>>I have tried using System.DateTime.Parse(this.txtDob.Text) but that causes another error.
>>
>>I think it's caused by the British date format.
>>
>>Any ideas on how to proceed?
>>
>>Thanks.
>>
>>John
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform