Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

daCR.Update(dsCR, "CR") - Concurrency Error

Status
Not open for further replies.

dtd00

Programmer
Dec 7, 2009
1
GB
Hi,

Trying to commit changes to a row but getting a concurrency error everytime I try the update.

This is a vb.net app for PocketPC 2002.

The data adapter is defined as follows:
Private Sub BindCR()
If daCR Is Nothing Then
SQL = "select * from CR where loc = '" & Me.cboloc.SelectedValue & "' order by name1
daCR = New SqlCeDataAdapter(SQL, cnCR)
daCR.UpdateCommand = New SqlCeCommand
With daCR.UpdateCommand
.Connection = cnCR
SQL = "update cr set accesscat = 'EH' where loc= 'test' and name1= 'testname'"
.CommandText = SQL
End With
End If

dtCR = dsCR.Tables("CR")
If dtCR Is Nothing Then
daCR.Fill(dsCR, "CR")
dtCR = dsCR.Tables("CR")
Else
dtCR.Clear()
daCR.Fill(dsCR, "CR")
End If
End Sub

I have simplified the update statement to try and eliminate everything but I am still getting the error. Any ideas?

Thanks,
 
First, while some may be able to just look and spot the problem you really need to give the full error not just what type it is. Secondly, the line the error occurs on is really helpful. I've never used an Sql[red]Ce[/red]DataAdapter and I can't say that it is 100% wrong, but proper procedure is to create the update command then assign it to the DataAdapters update.

Code:
            Dim scc As New SqlCeCommand
            With scc
                .Connection = cnCR
                Sql = "update cr set accesscat = 'EH'  where loc= 'test' and name1= 'testname'"
                .CommandText = Sql
            End With
            daCR.UpdateCommand = scc
        End If
That may have nothing to do with your error though.

-I hate Microsoft!
-Forever and always forward.
-My kingdom for a edit button!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top