Se agrega comilla simple cuando contenga una

This commit is contained in:
janeth arvizu
2019-10-25 13:13:35 -07:00
parent ca4763dc0d
commit f36ba64403

View File

@@ -1819,15 +1819,19 @@ Partial Class RegPoliza
Dim Referencia As String = Row("Referencia").ToString
Dim Cuenta As String = Row("Código Cuenta").ToString + " - " + Row("Nombre Cuenta").ToString
Dim Cuenta2 = AgregaComilla(Cuenta) 'Agregar otra comilla simple adicional cuando contenga una
Dim CveCuenta As String = ""
If DTCuentas.FiltroPrimero("CtaCodigo = '" & Cuenta & "'") IsNot Nothing Then
CveCuenta = DTCuentas.FiltroPrimero("CtaCodigo = '" & Cuenta & "'")("Id").ToString
If DTCuentas.FiltroPrimero("CtaCodigo = '" & Cuenta2 & "'") IsNot Nothing Then
CveCuenta = DTCuentas.FiltroPrimero("CtaCodigo = '" & Cuenta2 & "'")("Id").ToString
End If
Dim SegNeg As String = Row("SegNeg").ToString
Dim SegNeg2 = AgregaComilla(SegNeg) 'Agregar otra comilla simple adicional cuando contenga una
Dim IdSegNeg As String = ""
If DTSegmentosNegocio.FiltroPrimero("Nombre = '" & SegNeg & "'") IsNot Nothing Then
IdSegNeg = DTSegmentosNegocio.FiltroPrimero("Nombre = '" & SegNeg & "'")("Id").ToString
If DTSegmentosNegocio.FiltroPrimero("Nombre = '" & SegNeg2 & "'") IsNot Nothing Then
IdSegNeg = DTSegmentosNegocio.FiltroPrimero("Nombre = '" & SegNeg2 & "'")("Id").ToString
End If
Dim Concepto As String = Row("Nombre/Concepto").ToString
@@ -1884,4 +1888,18 @@ Partial Class RegPoliza
DescargarFormato()
End Sub
Private Function AgregaComilla(str As String) As String
If str.Contains("'") Then
Dim arr = Split(str, "'")
str = ""
For i = 0 To arr.Length() - 1
If i = arr.Length - 1 Then
str += arr(i)
Else
str += arr(i) + "''"
End If
Next
End If
Return str
End Function
End Class