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 / .NET Framework / ADO.NET / March 2004

Tip: Looking for answers? Try searching our database.

A simple binding question

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Doug Lowe - 27 Feb 2004 22:01 GMT
Hi all, this might be a simple question, but then again maybe not. I'm
binding a text box in a Windows form to a column that does not allow nulls.
The problem is, if I do AddNew, the user leaves the field blank, and I call
EndCurrentEdit, I get a "null not allowed" exception. What I want is to put
an empty string in the column. Is there something I'm overlooking?

--Doug
Shane Brodie - 27 Feb 2004 22:41 GMT
Try setting the content of your text field to "" after invoking your AddNew
call

AddNew()
txtMyField.Text = ""

Regards

Shane

> Hi all, this might be a simple question, but then again maybe not. I'm
> binding a text box in a Windows form to a column that does not allow nulls.
[quoted text clipped - 3 lines]
>
> --Doug
Doug Lowe - 27 Feb 2004 23:39 GMT
Thanks, Shane. That doesn't help though. I still get the exception. It does
work if I set the text box to " " (one space) but that's not at all what I
want.

The exception is happening before I get to the EndCurrentEdit method
call...before the click event handler is called, in fact. It must be burried
somewhere in the binding manager. Its as if the binding manager is looking
at my text box, seeing that I didn't enter anything, and trying to set the
bound column to null even though the column doesn't allow nulls.

I hope I'm missing something real obvious :)

--Doug

> Try setting the content of your text field to "" after invoking your AddNew
> call
[quoted text clipped - 16 lines]
> >
> > --Doug
Abul Hasan - 01 Mar 2004 17:35 GMT
Hey,

Try to create a default constraint on the column. for instance 'N/A' or
'UNKNOWN'

> Thanks, Shane. That doesn't help though. I still get the exception. It does
> work if I set the text box to " " (one space) but that's not at all what I
[quoted text clipped - 31 lines]
> > >
> > > --Doug

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.