dotnet windows forms databinding:
This error occurs with respect to all of the cases where a combobox represents an optional, nullable column that is constrained by a foreign key and an attempt is made to save a new record and the user has made no manual selection using the combobox. The error has been narrowed down to the failure of the combobox control to automatically bind to the assigned, initial System.DBNull.Value when the new record is initially automatically filled in by the system. (Instead the combobox erroneously binds to zero.) However, if the user selects the blank item in the combobox (associated with System.DBNull.Value), then the System.DBNull.Value does successfully bind to the control. As a result of this binding failure, an attempt to save the record throws a foreign-key constraint failure, and the record will not save. Any help anyone could give would be much appreciated!
Hi, I think There is one option that u can try............ It will be Better to fetch the Some "NONE ID" say 0 for all those Record which has Null Value............Than just add One Row to ur Combo's Datatable With Same "NONE ID" so that instead of taking system.null Value r u Combo will select "None" Record. While Saving (If u r Using Stored Proc) check if that Particular Value is "NONE ID" than Insert Null Value else COntinue with the Input Parameter Value........... I hope u got what i am Trying to explain................ --
Don't see what you're looking for? Try a search.
|