[RESOLVED] Not all values being sent to database
Here is part of my code:
Code:
Private Sub ESignSubmitButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ESignSubmitButton.Click
Me.Validate()
Me._859BindingSource.EndEdit()
Me.ATCFormsDataDataSet._859.Item(Me._859BindingSource.Position).IsException = recordIsAnException()
Me.ATCFormsDataDataSet._859.Item(Me._859BindingSource.Position).SubmissionDate = Now
Me.ATCFormsDataDataSet._859.Item(Me._859BindingSource.Position).SubmittedBy = Environment.UserName.ToUpper
If formIsComplete() Then
Dim promptQuestion As DialogResult = MessageBox.Show("Are you sure?", "Submit?", MessageBoxButtons.YesNo, MessageBoxIcon.Question)
If promptQuestion = Windows.Forms.DialogResult.No Then
Exit Sub
End If
Try
Me.TableAdapterManager.UpdateAll(Me.ATCFormsDataDataSet)
MessageBox.Show("Form submitted successfully", "Successful")
Me.Close()
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
End If
End Sub
Here is my problem. My controls on the form were created from dragging and dropping one of my tables from the data explorer window onto the form in details form, not gridview. Amongst these controls are four comboboxes whose text properties are databound, but their items lists are not bound. When I click my submit button, all the data is sent to the database except the text from these four comboboxes. I have looked everywhere I can think of and can't figure out why the text from those comboboxes isn't being updated in the db.
Re: Not all values being sent to database
by the way, the database is access 2007.
Re: Not all values being sent to database
Please explain exactly what data is in those ComboBoxes and how it relates to the bound table. The usual way to use ComboBoxes is to bind a parent list using the DataSource and then bind the child list via the SelectedValue, which would usually be the ID from the parent.
Re: Not all values being sent to database
The bindings are the defaults that were created when I dragged and dropped the table onto the form, which from what I can tell, is the text property of the comboboxes. The items in the comboboxes are hardcoded in the items collection using the properties window available in the designer. It's the text of the comboboxes that I want to be saved in the db.
Re: Not all values being sent to database
If you navigate from record to record in the bound table, do those ComboBoxes update?
Re: Not all values being sent to database
Sorry, the form's purpose is only to add one record and then close. There is no bindingnavigator.
Re: Not all values being sent to database
I deleted the comboboxes in question and recreated them and it worked so who knows what went wrong. Thanks for your time John.