(23-11-2022, 02:56)alessandri escribió: conn.exec("inset into puntos set codigo=2,nombre='ALESSANDRI E GUZMAN',debito=4483.04,detalle='venta factura No.'582,fecha='2022/11/21',usuario='ales'") 'sentencia con error
Veo que entre "factura No." y "582" hay un " ' " (
Chr(39) ) que puede ser la causa del problema.
Si es eso, tal vez te sirva esta función que hice hace un tiempo:
Código:
'' Returns a text suitable for SQL queries, removes line breaks and characters not compatible with SQL statements.
Static Public Function Chek4SQL(strInput As String) As String
Dim strOutput As String
strOutput = Replace(strInput, Chr(92) & Chr(110), ":")
strOutput = Replace(strOutput, Chr(34), "")
strOutput = Replace(strOutput, "\n", " ")
strOutput = Replace(strOutput, "\r", "")
strOutput = Replace(strOutput, "\x00", "")
strOutput = Replace(strOutput, Chr(39), Chr(46)) ' ' > .
strOutput = Replace(strOutput, Chr(44), Chr(46)) ' , > .
Return strOutput
End