Private Sub conSave() Dim con As OleDbConnection Dim conAdapter As OleDbDataAdapter Dim dbCommand As OleDbCommand Dim ds As New DataSet Dim cb As OleDbCommandBuilder con = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Users\hp\Documents\dbLedger.mdb") con.Open() dbCommand = New OleDbCommand("SELECT * FROM tbItemList", con) conAdapter = New OleDbDataAdapter conAdapter.SelectCommand = dbCommand conAdapter.Fill(ds, "tbItemList") cb = New OleDbCommandBuilder(conAdapter) Dim dsNewRow As DataRow dsNewRow = ds.Tables("tbItemList").NewRow() With dsNewRow .Item("ID") = Val(lblID.Text) .Item("iName") = txtName.Text .Item("ItemType") = cbbItemType.Text .Item("UnitName") = txtUnit.Text .Item("SubunitName") = txtSubunit.Text .Item("DefaultUnit") = cbbDefaultUnit.Text .Item("Algorithm") = txtAlgorithm.Text .Item("Note") = txtNote.Text End With ds.Tables("tbItemList").Rows.Add(dsNewRow) conAdapter.Update(ds, "tbItemList") con.Close() con.Dispose() conAdapter.Dispose() dbCommand.Dispose() ds.Dispose() cb.Dispose() MsgBox("Save complete!") End Sub
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)