Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Windows Forms / WinForm Data Binding / December 2004

Tip: Looking for answers? Try searching our database.

failure of combobox to bind to DBNull

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Phillip Engle - 03 Dec 2004 04:38 GMT
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!
Ritesh Jain - 16 Dec 2004 15:48 GMT
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................

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.