Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DataSet not recognizing added rows

Status
Not open for further replies.

jmikow

Programmer
Mar 27, 2003
114
US
I have a Data Adapter that fills a DataSet and binds to a DataGrid. That works properly and the datagrid displays the rows that I expect to be retrieved.

I then have another button that loops through the contents of the populated datagrid and inserts the rows into a separate dataset. That dataset is then bound to a separate datagrid. The 2nd datagrid binds and displays properly as I expect it to.

The problem that I have is that when I go to update the data back to the database for the 2nd dataset it does not want to work. It does not recognize that there is any new data in the dataset. I even tried to have it show me how many items are in the dataset table and it says there are 0 rows.

Here's my code that adds the rows to the 2nd DataSet:

Code:
        Dim dgrdrow As DataGridItem

        For Each dgrdrow In dgrdRecorder.Items
            Dim newrow As dsARI.TransfersRow = DsARI.Transfers.NewRow
            newrow.TransferDate = CType(dgrdrow.FindControl("lblRecordingDate"), Label).Text
            newrow.DocumentNumber = CType(dgrdrow.FindControl("lblDocumentNumber"), Label).Text
            newrow.APNs = CType(dgrdrow.FindControl("lblAPNs"), Label).Text
            newrow.ImagePath = CType(dgrdrow.FindControl("lblImagePath"), Label).Text
            newrow.BizFlowStart = "N"
            DsARI.Transfers.AddTransfersRow(newrow)
        Next
        dgrdARI.DataBind()

Here is the code that happens when I press the button to save the data back to the database:

Code:
    Private Sub btnSaveToARI_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSaveToARI.Click
        daARI.Update(DsARI.Transfers)
    End Sub

Any suggestions would be helpful.

Thanks,

Josh
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top