Buenas tardes por favor si alguien me pueda ayudar ya llevo una seman
bsucando respueta y nadie me da una pro favor amigos
el problema es el siguiente:
todo me funciona bien hasta que yo hago la siguiente maniobra:
agrego un nuevo registro
Public Sub RegGrabar()
If (ValidacionCampos() = False) Then
Exit Sub
Else
Dim dr As DataRow = Ds.Tables(0).NewRow
Dim CODIGO = Me.ObjClsAplication.GenerarCodigo("select
max(CodigoCliente) from cliente ")
Me.AsignarDatos(dr, CODIGO)
Me.txtCodigoid.Text = CODIGO
Ds.Tables(0).Rows.Add(dr)
'Guardar en la Base de datos Fisicamente
Try
Dim oChangeRows As DataSet = Ds.GetChanges
DaCliente.Update(oChangeRows, "cliente")
Ds.Tables(0).AcceptChanges()
'Ds.Merge(oChangeRows)
MessageBox.Show("Registro Guardado")
MessageBox.Show(Ds.Tables(0).Rows.Count.ToString - 1)
Me.HabilitarBotonesYOrdenes()
Me.tbToolbarCliente.Buttons.Item(Me.ObjClsAplication.OperacionesBD.Grabar).Enabled = False
Me.txtEnabledFalse()
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
End If
End Sub
(2) y de ahi le doy siguiente con los botones de desplasamiento que tengo
Public Sub RegSiguiente()
Fila = Fila + 1
If (Fila > Ds.Tables(0).Rows.Count - 1) Then
Fila = Ds.Tables(0).Rows.Count - 1
Me.MenuCliente.MenuItems.Item(Me.ObjClsAplication.OperacionesBD.Siguiente).Enabled = False
Me.MenuCliente.MenuItems.Item(Me.ObjClsAplication.OperacionesBD.Ultimo).Enabled = False
Else
Me.MenuCliente.MenuItems.Item(Me.ObjClsAplication.OperacionesBD.Primero).Enabled = True
Me.MenuCliente.MenuItems.Item(Me.ObjClsAplication.OperacionesBD.Anterior).Enabled = True
End If
LinkControls(Fila)
End Sub
(3) de ahi le doy eliminar
Public Sub RegDelete()
If Fila < 0 OrElse Fila > Ds.Tables(0).Rows.Count - 1 Then Exit Sub
Try
Ds.Tables(0).Rows(Fila).Delete()
Dim OchangeRows As DataSet = Ds.GetChanges(DataRowState.Deleted)
DaCliente.Update(OchangeRows, "cliente")
Ds.Tables(0).AcceptChanges()
MessageBox.Show("Registro Eliminado")
Me.RegPrimero()
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
End Sub
me sale el siguiente error :
Concurrency violation: the DeleteCommand affected 0 records
por favor si alguien me podria ayudar
Nota: una consulta mas
yo estaba utilizando esto
Dim OchangeRows As DataSet = Ds.GetChanges
y por ahi encontre esto:
Dim OchangeRows As DataSet = Ds.GetChanges(DataRowState.Deleted)
Cual es la direfencia me da igual resultados pero me gustaria saber Gracias
de antemano estare esperando respuesta
Atentamente Luis Saavedra Linares
Leer las respuestas