I get the following message when executing the code below. "Update requires a valid Update Command when passed DataRow collection with modified rows"
[CODE]
Dim accessadapter As New DataSet1TableAdapters.AccessDataTableAdapter
Dim laccess As New DataSet1.AccessDataDataTable
Dim accessdataadapter As New DataSet1TableAdapters.AccessDataTableAdapter
Dim laccessdata As New DataSet1.AccessDataDataTable
lcardsprinted = cardsprintedadapter.GetDataCardsPrinted
laccessdata = accessdataadapter.GetDataAccessData
Try
For Each cardsprintedRow As DataSet1.CardsPrintedRow In lcardsprinted
cardsprintedRow.TransferredToEvolution = True
cardsprintedRow.MembershipYear = 2021
Next
cardsprintedadapter.Update(lcardsprinted)
For Each accessdataRow As DataSet1.AccessDataRow In laccessdata
accessdataRow.CardImprint = 1803
accessdataRow.ExpiryYear = Year(Now) + 1
accessdataRow.Data_1 = 627
Next
accessdataadapter.Update(laccessdata)
Catch ex As Exception
MsgBox(ex.Message)
End Try
[CODE]
The first "For - Next Loop" executes and updates without a problem, however the second "For - Next Loop" executes but will not update and gives the following message:- "Update requires a valid Update Command when passed DataRow collection with modified rows"
Both datasets are used in other routines without any problems.
I have made many attemps to correct the issue without success. What am I doing wrong?
[CODE]
Dim accessadapter As New DataSet1TableAdapters.AccessDataTableAdapter
Dim laccess As New DataSet1.AccessDataDataTable
Dim accessdataadapter As New DataSet1TableAdapters.AccessDataTableAdapter
Dim laccessdata As New DataSet1.AccessDataDataTable
lcardsprinted = cardsprintedadapter.GetDataCardsPrinted
laccessdata = accessdataadapter.GetDataAccessData
Try
For Each cardsprintedRow As DataSet1.CardsPrintedRow In lcardsprinted
cardsprintedRow.TransferredToEvolution = True
cardsprintedRow.MembershipYear = 2021
Next
cardsprintedadapter.Update(lcardsprinted)
For Each accessdataRow As DataSet1.AccessDataRow In laccessdata
accessdataRow.CardImprint = 1803
accessdataRow.ExpiryYear = Year(Now) + 1
accessdataRow.Data_1 = 627
Next
accessdataadapter.Update(laccessdata)
Catch ex As Exception
MsgBox(ex.Message)
End Try
[CODE]
The first "For - Next Loop" executes and updates without a problem, however the second "For - Next Loop" executes but will not update and gives the following message:- "Update requires a valid Update Command when passed DataRow collection with modified rows"
Both datasets are used in other routines without any problems.
I have made many attemps to correct the issue without success. What am I doing wrong?