Results 1 to 7 of 7

Thread: [RESOLVED] Not all values being sent to database

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jul 2010
    Posts
    86

    Resolved [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.

  2. #2

    Thread Starter
    Lively Member
    Join Date
    Jul 2010
    Posts
    86

    Re: Not all values being sent to database

    by the way, the database is access 2007.

  3. #3
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    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.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  4. #4

    Thread Starter
    Lively Member
    Join Date
    Jul 2010
    Posts
    86

    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.

  5. #5
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: Not all values being sent to database

    If you navigate from record to record in the bound table, do those ComboBoxes update?
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  6. #6

    Thread Starter
    Lively Member
    Join Date
    Jul 2010
    Posts
    86

    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.

  7. #7

    Thread Starter
    Lively Member
    Join Date
    Jul 2010
    Posts
    86

    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width