Problemas al actualizar un TDBgrid Hola
Tengo un problema con un programita en Visual basic 6.0, esto es que no me marca un error solo que cuando quiero actualizar un grid me devuelve al Do while, pero no me marca ningun error y esto es solo en algunos articulos que tengo no en todos, espero alguien me pueda ayudar.
Gracias
Private Sub AutorizaReq()
Dim cmCmd As New ADODB.Command
Dim r As Long
Dim lngA As Long 'Contador de registros actualizados
Dim lngE As Long 'Contador de registros erroneos
Dim lngL As Long 'Contador de registros no tratados correctamente
Dim flgError As Boolean, flgFinal As Boolean
If Table(0).ApproxCount = 0 Then Exit Sub
lngA = 0
lngE = 0
lngL = 0
rsAutor.MoveFirst Do While Not rsAutor.EOF
On Error GoTo TrataError
If rsAutor("bolModifico") <> 0 Then
ccStatus = cERR_DB_NOCONEXION
ccUltimoMensaje = ""
ccStatus = cERR_USR_NOSESION
flgError = False
strSP = "{ call QryEXCM2020_AutorizaReq20040720(@,@,@,@,@,@,?)}"
strQuery = LLenaParametrosSP2(strSP, rsAutor("dblrequisicion") & "|" & rsAutor("Sel") & "|" & rsAutor("intEmpresa") & "|" & _
rsAutor("intDirectoOC") & "|" & Comy(UsuarioPral) & "|" & Comy(strMaquina))
strQuery = strQuery
Set cmCmd = New ADODB.Command
With cmCmd
.ActiveConnection = Conexion ' objSesion.ConexionDB
.CommandType = adCmdText
.CommandText = strQuery
.CommandTimeout = 0
Set pParam01 = .CreateParameter("Result", adBigInt, adParamOutput)
.Parameters.Append pParam01
End With
cmCmd.Execute
If Not flgError Then
If IIf(IsNull(pParam01.Value), 0, pParam01.Value) = 1 Then
ccStatus = cOK
ccUltimoMensaje = cNULO
lngA = lngA + 1
Else
ccStatus = pParam01.Value
'ccUltimoMensaje = pParam02.Value
lngE = lngE + 1
End If
End If
Set cmCmd = Nothing
lngL = lngL + 1
End If
rsAutor.MoveNext
Loop
lngL = lngL - (lngA + lngE)
If ccStatus = cOK Then
MsgBox "Su información ha quedado registrada." & vbCrLf & "Registros Autorizados: " & lngA & vbCrLf & "Errores en el proceso: " & lngE, vbInformation, "Sistema"
Call CargaReqPrecios
Call Deshacer
Else
If ccStatus = 17 Then
MsgBox "La cantidad por autorizar es mayor al consumo autorizado ", vbInformation, Me.Caption
Exit Sub
End If
If ccStatus = -20 Then
MsgBox "Ya esta Cancelada", vbInformation, Me.Caption
Exit Sub
End If
If ccStatus = -12 Then
MsgBox "La Requisicion no ha sido Autorizada por el Gerente", vbInformation, Me.Caption
Exit Sub
End If
End If
Exit Sub
TrataError:
ccStatus = Err.Number
ccUltimoMensaje = "<METODO: > " & Err.Description & " QUERY : " & strQuery
flgError = True
Screen.MousePointer = Default
RegistrarErr ccStatus, ccUltimoMensaje
MsgBox "error " & ccUltimoMensaje
Resume Next
End Sub |