Click here to Skip to main content
15,037,420 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I have a vb.net in vs 2010. I have a local sqlce database 3.5 that I inserted in the project. When I go into the visual data designer and drag a table to it then right click on the tableadapter, and hit the advanced button, the "optimistic concurrency" option is disabled. Meaning, I cant select it. How can I enable it. When I go to update this table it is causing a concurrency error, thus not updating the row. any suggestions?
Posted

Something isn't adding up. Are you saying that you're using SQLCE in a multiuser environment?? If not, then you shouldn't be having concurrency problems. It sounds as though your code is competing against itself for control of records. Without seeing how you code is retrieving and updating records, it's pretty difficult to tell you what's going on.
   
Comments
Tony Palumbo 6-Feb-12 17:58pm
   
Hi David,

Here is code:

'try
If tempDate = Today And bsRunInformation.Current("UniqueNumber") = Fields(1) Then
frmMain.bsRunInformation.Current("Description") = StripString(Fields(2))
frmMain.Validate()
frmMain.bsRunInformation.EndEdit()
frmMain.TblRunInformationTableAdapter.Update(frmMain.DsSkySkor1.tblRunInformation) 'Soon as I call this I get DBConcurrencyException not handled

'Catch ex As DBConcurrencyException

'End Try
MsgBox("Update current record " & Fields(2))
Else

frmMain.TblRunInformationTableAdapter.FillSingleRow(frmMain.DsSkySkor1.tblRunInformation, Today, Fields(1))
frmMain.bsRunInformation.Current("Description") = StripString(Fields(2))
frmMain.Validate()
frmMain.bsRunInformation.EndEdit()
frmMain.TblRunInformationTableAdapter.Update(frmMain.DsSkySkor1.tblRunInformation)'Soon as I call this I get DBConcurrencyException not handled
'Catch ex As DBConcurrencyException

'End Try
End If
Hi David,

Here is code:

'try
If tempDate = Today And bsRunInformation.Current("UniqueNumber") = Fields(1) Then
frmMain.bsRunInformation.Current("Description") = StripString(Fields(2))
frmMain.Validate()
frmMain.bsRunInformation.EndEdit()
frmMain.TblRunInformationTableAdapter.Update(frmMain.DsSkySkor1.tblRunInformation) 'Soon as I call this I get DBConcurrencyException not handled

'Catch ex As DBConcurrencyException

'End Try
MsgBox("Update current record " & Fields(2))
Else

frmMain.TblRunInformationTableAdapter.FillSingleRow(frmMain.DsSkySkor1.tblRunInformation, Today, Fields(1))
frmMain.bsRunInformation.Current("Description") = StripString(Fields(2))
frmMain.Validate()
frmMain.bsRunInformation.EndEdit()
frmMain.TblRunInformationTableAdapter.Update(frmMain.DsSkySkor1.tblRunInformation)'Soon as I call this I get DBConcurrencyException not handled
'Catch ex As DBConcurrencyException

'End Try
End If
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900