Hi All,
This is the code i am using to load data from an access database and the code used to update the database:
vb Code:
Public custDA As OleDb.OleDbDataAdapter Public CustDS As New DataSet Private Sub frmCustomersContainer_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load custDA = New OleDb.OleDbDataAdapter("SELECT * FROM Customers ORDER By Customers.customer ASC", con) custDA.Fill(CustDS) Dim custTbl As DataTable = CustDS.Tables(0) Me.dgvCustomers.DataSource = custTbl Me.dgvCustomers.Columns(0).Visible = False Me.dgvCustomers.Columns(1).Width = Me.dgvCustomers.Width - 15 End Sub
vb Code:
Private Sub frmCustDetailsDetails_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim tbl As DataTable = frmCustomersContainer.CustDS.Tables(0) txtAddress.DataBindings.Add("Text", tbl, "Address") txtPostcode.DataBindings.Add("Text", tbl, "PostCode") End Sub Private Sub frmCustDetailsDetails_Leave(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Leave If frmCustomersContainer.CustDS.HasChanges Then frmCustomersContainer.CustDS.AcceptChanges() frmCustomersContainer.custDA.Update(frmCustomersContainer.CustDS.Tables(0)) End If End Sub
When i change either txtaddress or txtpostcode the dataset is updated but not the database.
What am i missing?
TIA
Rico


Reply With Quote
