Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I think the best way is to use <code>OleDBAdapter</code> class. You need to first build your database before you proceed this process. As it is needed by the <code>OleDBAdapter</code>. If you recall, you use the DataAdapter's <code>Fill()</code> method to read the contents of a table in a database and fill our locally-cached DataTable object. </p> <p>There are 3 steps to saving data in ADO.Net:</p> <ul> <li>Get a locally cached copy of the data with the <code>Fill()</code> method</li> <li>Write code (or use a control) that makes changes to the locally cached copy</li> <li>Save the changes back to the underlying database with the <code>Update()</code> method</li> </ul> <p>Here's the code,</p> <pre><code>Using conn As New OleDBConnection("connectionString Here") Using comm As New OleDBCommand() With comm .Connection = conn .CommandType = CommandType.CommandText .CommandText = "SELECT * FROM youTableName" End With Using adapter As New OleDBDataAdapter(comm) Dim _dataTable As New DataTable() adapter.Fill(_dataTable) 'add you records here ' ' preferably by using loop ' Dim _dataRow As DataRow _dataRow = _dataTable.NewRow() _dataRow("colNameA") = "valueA" _dataRow("colNameB") = "valueB" '........ ' _dataTable.Rows.Add(_dataRow) Dim dt_changes As DataTable dt_changes = _dataTable.Changes() If Not IsNothing(dt_changes) Then Using commBuild As OleDbCommandBuilder(adapter) Dim rowCount as Integer = adapter.Update(dt_changes) MsgBox(rowCount &amp; " updated") End Using End If End Using End Using End Using </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload