
Dataset changes updates grid , How to update SQL table
I think the problem is that you're updating the local Employees1 dataset,
but then you call update on Me.Employees1, a different dataset.
I would try not to use the same variable names, because this causes
confusion.
What does Me.FillDataSet do?
What is DataGrid1 bound to?
Lorenzo Minore,
VB .Net development
--
This posting is provided "AS IS" with no warranties, and confers no rights.
Quote:
> Ive got what should be a simple dataset update problem. Ive got the
> dataset edited and my changes show up in the datagrid after
> datagrid1.refresh, but how do i get the changes from the dataset to be
> applied to the SQL table. Ive tried updating the adapter and various
> other things. What am i missing?
> Dim x, hold1 As Integer
> Dim mydatarow As DataRow
> Dim check1, fname, lname, name1 As String
> Dim Employees1 As DataSet = Employees1
> Cursor.Current = Cursors.WaitCursor
> Me.FillDataSet(Employees1)
> For Each mydatarow In Me.Employees1.Tables("Data_Employees").Rows
> name1 = (mydatarow("holdname").ToString())
> hold1 = Len(name1)
> For x = 1 To hold1
> check1 = name1.Substring(x - 1, 1)
> If check1 = "," Then
> lname = name1.Substring(0, x - 1)
> fname = name1.Substring(x + 1, (hold1 - x) - 1)
> mydatarow.BeginEdit()
> mydatarow.Item("Firstname") = fname
> mydatarow.Item("Lastname") = lname
> mydatarow.AcceptChanges()
> Exit For
> End If
> Next
> Next
> Me.DataGrid1.Refresh()
> Me.OleDbDataAdapter1.Update(Me.Employees1, "Data_Employees") 'IS THIS
> CORRECT?
> Cursor.Current = Cursors.Default
> The bound datagrid shows the proper changes as they should be in the
> sql table when finished. How do i make the table update????
> Thanks in advance
> Don.S