D
Dave
I'm just starting to try and learn ADO.NET and was following along in
Murach's VB.NET/ADO.NET book samples for typed databases with unbound
controls.
When I try to execute an update with the my data adapter and the data table
as a parameter, daMembers.Update(dsMembers.Member_Listing), I get a
concurrency violation. I'm not sure how to track down the problem.
Basically I'm doing the following; open the connection, set data adapters
selectcommand text, fill the dataset, get a data row from the table, put the
data into controls on a form, change the data, put the changes into the data
row, and execute the update command.
' load dataset
cnRosterDB.Open()
daMemberList.SelectCommand.CommandText = sSelectCommand
daMemberList.Fill(dsMembers)
cnRosterDB.Close()
' get a record
drMemberRow = dsMembers.Member_Listing(0)
With drMemberRow
txtID.Text = .member_ID
If .Islast_nameNull Then
txtLName.Text = ""
Else
txtLName.Text = .last_name
End If
If .Isfirst_nameNull Then
txtFName.Text = ""
Else
txtFName.Text = .first_name
End If
end with
' put edited data into data row
With drMemberRow
.member_ID = CInt(txtID.Text)
.last_name = txtLName.Text
.first_name = txtFName.Text
end with
' try to update the database
daMemberList.Update(DsMembers.Member_Listing)
Any guidance would be appreciated,
Thanks
Dave
Murach's VB.NET/ADO.NET book samples for typed databases with unbound
controls.
When I try to execute an update with the my data adapter and the data table
as a parameter, daMembers.Update(dsMembers.Member_Listing), I get a
concurrency violation. I'm not sure how to track down the problem.
Basically I'm doing the following; open the connection, set data adapters
selectcommand text, fill the dataset, get a data row from the table, put the
data into controls on a form, change the data, put the changes into the data
row, and execute the update command.
' load dataset
cnRosterDB.Open()
daMemberList.SelectCommand.CommandText = sSelectCommand
daMemberList.Fill(dsMembers)
cnRosterDB.Close()
' get a record
drMemberRow = dsMembers.Member_Listing(0)
With drMemberRow
txtID.Text = .member_ID
If .Islast_nameNull Then
txtLName.Text = ""
Else
txtLName.Text = .last_name
End If
If .Isfirst_nameNull Then
txtFName.Text = ""
Else
txtFName.Text = .first_name
End If
end with
' put edited data into data row
With drMemberRow
.member_ID = CInt(txtID.Text)
.last_name = txtLName.Text
.first_name = txtFName.Text
end with
' try to update the database
daMemberList.Update(DsMembers.Member_Listing)
Any guidance would be appreciated,
Thanks
Dave