When I sort or filter a datagridview, the underlying Dataset remains unchanged so I can not use NewTableRow as a way to update the database:
The following is an example of my sort
Dim SortSQL As String
Dim SaveDataSource As BindingSource
Dim NewRow As VideoDBDataSet.RecTableRow
SaveDataSource = dgvRec.DataSource 'dgvRec is my DataGridView
SortSQL = "Title ASC, Release ASC"
adoMovieRS.Sort = SortSQL
adoMovieRS.Requery()
Validate()
RecTableBindingSource.EndEdit()
RecTableBindingSource.Sort = SortSQL
RecTableTableAdapter.Fill(VideoDBDataSet.RecTable)
RecTableTableAdapter.Update(VideoDBDataSet.RecTable)
RecTableAdapterManager.UpdateAll(VideoDBDataSet)
VideoDBDataSet.AcceptChanges()
NewRow = VideoDBDataSet.RecTable.Rows(0)
The NewRow is filled with the Original first record in the Dataset, not the sorted one.
I use the record within the datagridview to display a form that allows me to modify
the record content but sending that record back to the database via the DataSet
is not possible this way because the dataset indexes do not match the datagridview now.
BTW. The DataGridView sorts and filters just fine and I do not want to create a temporary
TableAdapter and Dataset as that will mess up the changes I have made to the DGV's
column order.
Thanks for any help, Lance