I am trying to update data in a datagrid that was generated by a view. I keep getting the error: "table has no primary key".
Here is the code that I am using:
Dim NewQuantity, NewAmount, NewrequestFilledBy, NewshipDate, Newtrackingid As String
Dim requestid As Integer
NewQuantity = CType(e.Item.Cells(3).Controls(0), TextBox).Text
NewAmount = CType(e.Item.Cells(4).Controls(0), TextBox).Text
NewrequestFilledBy = CType(e.Item.Cells(9).Controls(0), TextBox).Text
NewshipDate = CType(e.Item.Cells(10).Controls(0), TextBox).Text
Newtrackingid = CType(e.Item.Cells(11).Controls(0), TextBox).Text
requestid = dgPath.DataKeys(e.Item.ItemIndex)
Dim RgRow As dsPath.vwPathViewRow
RgRow = DsPath.Tables.Add.Rows.Find(requestid)
RgRow.quantity = NewQuantity
RgRow.amount = NewAmount
RgRow.requestFilledBy = NewrequestFilledBy
RgRow.shipDate = NewshipDate
RgRow.trackingID = Newtrackingid
Try
OleDbDataAdapter1.Update(DsPath)
Session("mydataset") = DsPath
Catch ex As DBConcurrencyException
Label1.Text = "This row has been updated by another user!"
DsPath.Clear()
OleDbDataAdapter1.Fill(DsPath)
Me.DataBind()
End Try
dgPath.EditItemIndex = -1
dgPath.DataBind()
Help with this would be greatly appreciated.