Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Input string was not in a correct format
Message
 
À
20/04/2006 08:01:13
Ilyas Mirza
Kensington Computersd
London, Royaume Uni
Information générale
Forum:
ASP.NET
Catégorie:
The Mere Mortals .NET Framework
Divers
Thread ID:
01114905
Message ID:
01115652
Vues:
14
Ilyas,

>I am having a problem with mmDropDownList control. The control is bound to a data source and gets its items from another table. if there are no items in the list to choose from then when saving the form, I get the following error: The dataField to which DropDownList is bound to may contain null value.
>
>System.FormatException: Input string was not in a correct format. at System.Number.ParseInt32(String s, NumberStyles style, NumberFormatInfo info) at System.String.System.IConvertible.ToInt32(IFormatProvider provider) at System.Convert.ToInt32(Object value) at System.Data.Common.Int32Storage.Set(Int32 record, Object value) at System.Data.DataColumn.set_Item(Int32 record, Object value)Couldn't store <> in Ticket_Contact_id Column. Expected type is Int32.
>
>If DropDownList is populated and I choose one of the valuse then you don't get the error.
>
>This is also true with other controls, for-example if a textbox is bound to a DateTime Field then upon saving if the data field was null and a date is not typed in the textbox, you get the same error.
>
>Does anyone know what's the best way to get round this issue.

There are a few ways to handle this. For example, you can change your database so it allows null values to be saved for these columns. You can also specify default values when creating a new DataRow. For more information on default values, check out the MM .NET Dev Guide topic "Setting Default Values in New Rows".

Best Regards,
Kevin McNeish
Eight-Time .NET MVP
VFP and iOS Author, Speaker & Trainer
Oak Leaf Enterprises, Inc.
Chief Architect, MM Framework
http://www.oakleafsd.com
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform