I've put some text boxes on a form, and a combobox.
bind them all to a dataset which I created (simple dataset, but have a join
in the select)
created teh update and insert commands manually
binded then texts box to the appropriate coloumns.
then added to the combobox change event:
index = cbxStudentID.SelectedIndex;
this.BindingContext[dsStudents1,"Students"].Position = index;
which makes all the text boxes sync with the current selection of the
combobox.
my problem is getting the changes I make in the text box go back to the
database.
I added a button, that upon clicked - runs:
da.update(dsStudents1,"Students")
when I clicked it, it tried to INSERT the rows to the database and ofcourse
failed on PK constraint.
I figured out all the row are in DataRowState.Added for some reason, so I
added an accept changed right after the fill to remove that.
but now nothing happens when I hit the update.
I've tried to enter the row to beginedit mode and then endedit each time the
combo is changed (and again last time when the button clicked) but the second
I use endedit on a row, all my changes dissapear.
I don't know how to do it right, hope someone can help me.
Regards,
Dani.
Sijin Joseph - 18 Oct 2004 05:18 GMT
Tyr calling EndCurrentEdit() on all the textboxes before calling da.Update()
Sijin Joseph
http://www.indiangeek.net
http://weblogs.asp.net/sjoseph
> I've put some text boxes on a form, and a combobox.
> bind them all to a dataset which I created (simple dataset, but have a join
[quoted text clipped - 24 lines]
> Regards,
> Dani.