W
wkpli
Guest
Hi,
I have a datagridview (dgv) which allows users to add rows on the fly. I have an ID field which is an auto-increment field, after the curAdapter.Update row (as seen below) is executed, the grids ID field is still null. How can I get the grid refreshed with the new ID while keeping all the settings that I had setup initially?
Initial settings
dgv.DataSource = curBindingSource
curAdapter = New SqlDataAdapter(selectCommand, connectionstring)
Dim commandBuilder As New SqlCommandBuilder(curAdapter )
curAdapter.Fill(curTable)
curBindingSource.DataSource = curTable
then add combobox columns, reordering the columns
Update
curAdapter.Update(CType(Me.curBindingSource.DataSource, DataTable))
Thanks in advance. Your help is greatly appreciated!
Continue reading...
I have a datagridview (dgv) which allows users to add rows on the fly. I have an ID field which is an auto-increment field, after the curAdapter.Update row (as seen below) is executed, the grids ID field is still null. How can I get the grid refreshed with the new ID while keeping all the settings that I had setup initially?
Initial settings
dgv.DataSource = curBindingSource
curAdapter = New SqlDataAdapter(selectCommand, connectionstring)
Dim commandBuilder As New SqlCommandBuilder(curAdapter )
curAdapter.Fill(curTable)
curBindingSource.DataSource = curTable
then add combobox columns, reordering the columns
Update
curAdapter.Update(CType(Me.curBindingSource.DataSource, DataTable))
Thanks in advance. Your help is greatly appreciated!
Continue reading...