1 Replies - 149 Views - Last Post: 09 January 2018 - 09:17 AM Rate Topic: ***-- 1 Votes

#1 LearnBeyond   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 09-January 18

Trying to update datarow in datagrid using tableadapter, gives error

Posted 09 January 2018 - 09:15 AM

Trying to update datarow in datagrid using tableadapter, gives an error saying - Parameter ?_11 has no default value.

Dim modified_rows2write As Integer = DT.Select(Nothing, Nothing, DataViewRowState.ModifiedCurrent).Length
        rows2write = modified_rows2write
        Do Until rows2write = 0
            Dim ModRows() As DataRow = DT.Select(Nothing, Nothing, DataViewRowState.ModifiedCurrent)

            Dim subrows() As DataRow = ToArray(ModRows.Take(1))
            Dim BranchID As Integer
            Dim row As DataRow
            Try
                'For each row in an array of modified rows, find the Branch Value and get its number and then assaign it to 
                  the 'row.Item("Branch") and then Update the Course TableAdapter.
                For Each row In subrows

                    If row.Item("Branch") Is DBNull.Value Then
                        row.Item("Branch") = "ISE"
                    End If
                    If row.Item("Location") Is DBNull.Value Then
                        row.Item("Location") = "unknown"
                    End If
                    If row.Item("ReceivedDateTime") Is DBNull.Value Then
                        row.Item("ReceivedDateTime") = Now()
                    End If
                    branchRowValue = row.Item("Branch")  
              'Get the corresponding ID for branch value, Branch column in the Course table in DB stores ID not its string value. 
                   BranchID = GetBranchIndex(branchRowValue)
                    row.Item("Branch") = BranchID  ' assinging its index value

                    Try
                        If 0 < CourseTableAdapter.Update(row) Then
                          Debug.Print("Data Saved")
                        End If
                        
                        Me.CourseTableAdapter.Fill(DT)
                    Catch ex As Exception
                        Throw New Exception("Unable to update the Course table")
                    End Try
                Next


Getting an error saying "OleDBException was caught - Parameter ?_11 has no default value".
What I am doing wrong in tableadapter.Update?


Is This A Good Question/Topic? 0
  • +

Replies To: Trying to update datarow in datagrid using tableadapter, gives error

#2 modi123_1   User is offline

  • Suitor #2
  • member icon



Reputation: 14094
  • View blog
  • Posts: 56,469
  • Joined: 12-June 08

Re: Trying to update datarow in datagrid using tableadapter, gives error

Posted 09 January 2018 - 09:17 AM

First off - why wouldn't you be interacting with the 'dataset' that would be the 'data source' for your 'data grid'?
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1