Hoping someone can help on this, I have searched without success so far.
I have a form with databound text boxes and combo boxes using a Bindsource and Binding Navigator.
I use the Add new button (of the Binding Navigator) to clear the text boxes for a new record, but then have a Update button on the form where I do an Insert query to SQL, which works because if I refresh the table in SQL the new row is there.
However when I then use the Binding Navigator 'move previous' button I get an error saying "Column 'AllowOverbook' does not allow nulls. " - now this is a column that is defined in the database to have 'Allow Nulls' = False, but I do not display this field on my form because in this case it is not required.
Instead I have it included on my Insert statement and just set it to '0'
Also when you look at the table every entry in the AllowOverbook column is '0' and there are no NULLS.
I think I need to refresh the Binding Navigator or Binding Source or the table adapter, but I have tried a few things, which I put in straight after executing the Insert statement, such as:
BindingSource1.ResetBindings(False) - I also tried TRUE
BindingNavigator1.Update
TableAdapter.GetData()
I have also tried putting in a text box for this field and defaulting it to 0, used as a hidden field - it is bound but has no effect
Nothing seems to stop this error when I try to navigate other rows straight after an Insert. But if I close the form and re-open it, I can immediately navigate through all the records and can see the most recently added record.
The reason I have the Update button is because I want to validate the fields before updating. Any help on this is appreciated.
I have a form with databound text boxes and combo boxes using a Bindsource and Binding Navigator.
I use the Add new button (of the Binding Navigator) to clear the text boxes for a new record, but then have a Update button on the form where I do an Insert query to SQL, which works because if I refresh the table in SQL the new row is there.
However when I then use the Binding Navigator 'move previous' button I get an error saying "Column 'AllowOverbook' does not allow nulls. " - now this is a column that is defined in the database to have 'Allow Nulls' = False, but I do not display this field on my form because in this case it is not required.
Instead I have it included on my Insert statement and just set it to '0'
Also when you look at the table every entry in the AllowOverbook column is '0' and there are no NULLS.
I think I need to refresh the Binding Navigator or Binding Source or the table adapter, but I have tried a few things, which I put in straight after executing the Insert statement, such as:
BindingSource1.ResetBindings(False) - I also tried TRUE
BindingNavigator1.Update
TableAdapter.GetData()
I have also tried putting in a text box for this field and defaulting it to 0, used as a hidden field - it is bound but has no effect
Nothing seems to stop this error when I try to navigate other rows straight after an Insert. But if I close the form and re-open it, I can immediately navigate through all the records and can see the most recently added record.
The reason I have the Update button is because I want to validate the fields before updating. Any help on this is appreciated.