Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

I'm working on a project that displays a datagrid with the table contents and then I am also binding a few textboxes to the fields in the table.

 

I know you can update the database from the datagrid but what I want to do is update from the textboxes as well. But when I try all I get is an error message saying that this field does not allow a Null value.

 

How can I allow a user to update a database from the textboxes instead of the datagrid?

 

Any help will be greatly appreciated. :)

Posted

First, does the column that you're trying to pass a null value from the form even allow Nulls? That's the first thing you'll need to check.

 

If your column is defined to allow nulls:

 

This is what I do for one of my forms to either set a value to a NullString, or to wrap the date string with single-quotes:

dim strEffDt as string = strEffDt = txtBusEffDate.Text

strEffDt = IIf(strEffDt = vbNullString, "Null", "'" & strEffDt & "'")

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...