W
Woody Splawn
I have a Winform with a DataSet that involves more than one table. I
thought I had working working well until I discovered today that values in
one of the tables are not getting saved when issuing an update command.
That is, I have a Students table and a Contracts table. I created a data
relation between the two tables (in the yellow schema window) called
DrStudentsContracts.
Lets say I want to bind a textbox to a field called Lname in the contracts
table. I can bind the textbox to a field from the contracts table or I can
bind to the same field in Students.DrStudentsContracts. If I do the later
and I retrieve several students into the Winform and move from record to
record, everything stays in sync. This is as I like it. The problem is
that if I do an update on the contracts table the values don't get saved.
If I bind the textbox to the Lname field in the contracts table (not
Students.DrStudentsContracts) and do an update, things get saved but when
several records are retrieved at the same time and I move from record to
record things don't stay in sync.
Is there a way for me to have my cake and eat it too? How do I set things
up so that I can keep things in sync when moving from record to record but
be able to save too?
At the time that I do the save I call a sub-routine below called
UpdateContracts()
Private Sub UpdateContracts()
Me.BindingContext(DsMain1, "Contracts").EndCurrentEdit()
Try
DaContracts.Update(DsMain1, "Contracts")
Catch ex As System.Data.SqlClient.SqlException
MsgBox(ex.ToString)
Finally
End Try
End Sub
thought I had working working well until I discovered today that values in
one of the tables are not getting saved when issuing an update command.
That is, I have a Students table and a Contracts table. I created a data
relation between the two tables (in the yellow schema window) called
DrStudentsContracts.
Lets say I want to bind a textbox to a field called Lname in the contracts
table. I can bind the textbox to a field from the contracts table or I can
bind to the same field in Students.DrStudentsContracts. If I do the later
and I retrieve several students into the Winform and move from record to
record, everything stays in sync. This is as I like it. The problem is
that if I do an update on the contracts table the values don't get saved.
If I bind the textbox to the Lname field in the contracts table (not
Students.DrStudentsContracts) and do an update, things get saved but when
several records are retrieved at the same time and I move from record to
record things don't stay in sync.
Is there a way for me to have my cake and eat it too? How do I set things
up so that I can keep things in sync when moving from record to record but
be able to save too?
At the time that I do the save I call a sub-routine below called
UpdateContracts()
Private Sub UpdateContracts()
Me.BindingContext(DsMain1, "Contracts").EndCurrentEdit()
Try
DaContracts.Update(DsMain1, "Contracts")
Catch ex As System.Data.SqlClient.SqlException
MsgBox(ex.ToString)
Finally
End Try
End Sub