data not adding to database properly!

Category: Visual Basic Questions    |    4 views
Hi

I have a form which adds data to a dataset, which can be viewed in a datagrid as it happens and then they finish and this adds it to the database - but after a short while the data that was added seems to rdissapear ffrom the database! Wondered if anyone could see where i may have gpne wrong!

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

        Dim drNew As System.Data.DataRow

        drNew = Me.UrlsDataSet.AllowedUrls.NewRow
        drNew.Item("URL") = urlTextBox.Text
        Me.UrlsDataSet.AllowedUrls.Rows.Add(drNew)

        Changes = True
        
    End Sub

    Sub AddData() ‘ add the new urls to the database

        Me.Validate()
        Me.AllowedUrlsBindingSource.EndEdit()
        Me.AllowedUrlsTableAdapter.Update(Me.UrlsDataSet.AllowedUrls)

        MsgBox("All new data added successfully!")

        Me.Close()

    End Sub

Share/Save/Bookmark

1 Star2 Stars
Loading ... Loading ...

0 responses so far!

Leave a Comment

*
To prove you're a person (not a spam script), type the security word shown in the picture. Click on the picture to hear an audio file of the word.
Click to hear an audio file of the anti-spam word