title: update database from data grid view in vb.net
body: <p>i have a data grid view, filled by data from database now i need to change the data and update database. </p>
  
  <pre><code> Private daVD As New OracleDataAdapter
      Private cmdJV As New OracleCommandBuilder
      Private dtVD As New DataTable()
  
  
  
   Dim cmd As New OracleCommand("Select JV_CODE,JV_ACC_NAME,DEBIT,CREDIT From VOUCHER_DETAIL where VOUCHERNO =:Vno", sgcnn)
              cmd.Parameters.Add("@Vno", OracleDbType.NVarchar2).Value = txtJVNo.Text.ToString.Trim
  
  
              dtVD.Clear()
              daVD = New OracleDataAdapter(cmd)
              daVD.Fill(dtVD)
              dgvAccDetail.AutoGenerateColumns = False
              dgvAccDetail.DataSource = dtVD
  
  
  
              If dtVD.Rows.Count &gt; 0 Then
                  For i As Integer = 0 To dtVD.Rows.Count - 1
                      ''Dim DataType() As String = myTableData.Rows(i).Item(1)
                      dgvAccDetail.Rows(i).Cells(0).Value = dtVD.Rows(i).Item("JV_CODE").ToString.Trim
                      dgvAccDetail.Rows(i).Cells(1).Value = dtVD.Rows(i).Item("JV_ACC_NAME").ToString.Trim
                      dgvAccDetail.Rows(i).Cells(2).Value = dtVD.Rows(i).Item("DEBIT").ToString.Trim
                      dgvAccDetail.Rows(i).Cells(3).Value = dtVD.Rows(i).Item("CREDIT").ToString.Trim
                  Next
              End If
  </code></pre>
  
  <p>i tried many different ways to update the database table but not working </p>
  
  <pre><code>      Try
          cmdJV = New OracleCommandBuilder(da)
         daJV.Update(ds, "VJ_Details")
          ds.AcceptChanges()
          MessageBox.Show(" The record has been updated.")
      Catch ex As Exception
  
          MsgBox(ex.Message)
  
      End Try 
  </code></pre>