[RESOLVED] [2005] DataSource Update problem
Code:
Dim row As DataRowView
row = DirectCast(Me.Lista_utilizatoriBindingSource.AddNew, DataRowView)
Me.dgv_utilizatori.CurrentRow.Cells(0).Value = Me.txt_nume_utilizator.Text
...
...
Me.dgv_utilizatori.CurrentRow.Cells(16).Value = Me.txt_ultima_autentificare.Text
Me.dgv_utilizatori.CurrentRow.Cells(17).Value = Me.txt_data_inregistrare.Text
Me.Lista_utilizatoriBindingSource.EndEdit()
Me.Lista_utilizatoriTableAdapter.Update(Me.Utilizatori_DataSet.lista_utilizatori)
This code is not working to insert a new record (row) to the database.
It's modifying me the current row selected.
What's wrong ?
Re: [2005] DataSource Update problem
Re: [2005] DataSource Update problem
It shouldn't be a surprise that you're editing the current row when you're specifically referring to the CurrentRow property. If you want to set the field values of the row you just added then do just that. You've got a reference to it right there:
Code:
row = DirectCast(Me.Lista_utilizatoriBindingSource.AddNew, DataRowView)
Re: [2005] DataSource Update problem
Quote:
Originally Posted by jmcilhinney
It shouldn't be a surprise that you're editing the current row when you're specifically referring to the CurrentRow property. If you want to set the field values of the row you just added then do just that. You've got a reference to it right there:
Code:
row = DirectCast(Me.Lista_utilizatoriBindingSource.AddNew, DataRowView)
I have a DGV and some TextBoxe's bounded to a binding source.
I've try it the .Insert() command but is not working too...
Then ?
Code:
if myproblem = "no_results" then
post on vbforums.com
else
google
end if
Re: [2005] DataSource Update problem
If your TextBoxes are bound to the same BindingSource as the grid then you don't need to do anything. Creating a new row and entering data in the TextBoxes will automatically push the data to the BindingSource. The grid is bound to the same BindingSource so it already contains the new data.
Re: [2005] DataSource Update problem
Quote:
Originally Posted by jmcilhinney
If your TextBoxes are bound to the same BindingSource as the grid then you don't need to do anything. Creating a new row and entering data in the TextBoxes will automatically push the data to the BindingSource. The grid is bound to the same BindingSource so it already contains the new data.
Do you know what jmcilhinney ?
Works now...
I know that you are bored to see all the time this on the forum but... there are poples like me that want to know more sily things. It's a matter of time, someday i will be able to tell to other users what did you tell me now... (is a long way, but i will).
Thanks alot man for your big help, realy thanks!