Windows Develop Bookmark and Share   
 index > Windows Forms Data Controls and Databinding > Using CommandBuilder Error
 

Using CommandBuilder Error

some time error through by commandBuilder,Concurrency violation: update command affected 0 of the expected 1 record,

although

dim row as datarow()=dataset.select("","",DataViewRowState.ModifiedCurrent)

if row.count>=1 then
{

call executeUpdateDateSet(busgerneral.ds,table,"select * from table")
busgerneral.ds.Tables(table).AcceptChanges()



Public Shared Function executeUpdateDataSet(ByVal dSet As DataSet, ByVal tblName As String, ByVal strSQL As String) As Integer

Dim DbAdapter As New SqlDataAdapter()

Dim DbCommand As New SqlCommand()

Try

If DbConn.State = 0 Then

createConn()

End If

DbCommand.Connection = DbConn

DbCommand.CommandText = strSQL

DbCommand.CommandType = CommandType.Text

DbAdapter.SelectCommand = DbCommand

Dim DbCommandBuilder As New SqlCommandBuilder(DbAdapter)

Return DbAdapter.Update(dSet, tblName)


}


i realy do not understand why command builder introduce me such error


}


i realy do not understand why command builder introduce me such error


}


i realy do not understand why command builder introduce me such error


}


i realy do not understand why command builder introduce me such error

DbCommandBuilder.ConflictOption = ConflictOption.OverwriteChanges

M.saqib  Saturday, August 29, 2009 5:48 PM
It's a concurrency error. You are trying to update a row in the database that doesn't exist (or was modified). This may happen if you have multiple users accessing the database.
Michal Burger  Sunday, August 30, 2009 8:53 AM
It's a concurrency error. You are trying to update a row in the database that doesn't exist (or was modified). This may happen if you have multiple users accessing the database.
Michal Burger  Sunday, August 30, 2009 8:53 AM

You can use google to search for other answers

Custom Search

More Threads

• How to programmatically "mark" a Binding to be "dirty?"
• DataGridView Autosize Row/Column
• Connect to SQL Server
• datagridview with checkbox
• Only selected row of datagridview get updated when underlying object raises PropertyChanged event
• Remove Data Sources from IDE
• data reader with richtextbox
• Assign variable to datagridview cell
• datagrideview and concurrency
• Remote sql server not connecting using windows forms