Visual Basic - problemas con la sintaxsis del UPDATE

Life is soft - evento anual de software empresarial
 
Vista:

problemas con la sintaxsis del UPDATE

Publicado por adriana (2 intervenciones) el 03/01/2005 17:16:27
Si yo pongo
UPDATE Clientes SET NPr = 28, Importe = 10,50 WHERE Provincia = 'Madrid' ----> me tira un error por el uso de la coma en el 10,50 ....

pero yo ese valor lo estoy tomando de un textbox ....

SQL = "UPDATE Clientes SET NPr = 28, Importe =" + tximporte.text + " WHERE Provincia = 'Madrid'"

¿como puedo hacer para que al tomarlo de un textbox me lo modifique a un punto .-

Gracias !!! ....
Adriana.
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder

RE:problemas con la sintaxsis del UPDATE

Publicado por shakaio (42 intervenciones) el 03/01/2005 17:47:18
PRIMERO CUENTA LOS QUE TIENES EN TEXTBOX CON LEN LUEGO SACA DE UNA EN UNA LOS NUMEROS Y PREGUNTA QUE CUANDO SEA , PONGA PUNTO. Y LISTO, MAS O MENOS ASI.

Dim LON As Integer
Dim LETRA As String

LON = Len(Text1.Text)
For I = 1 To LON
LETRA = Mid(Text1.Text, I, 1)
If LETRA = "," Then
LETRA = "."
End If

Text2.Text = Text2.Text + LETRA ' PUEDE SER EN OTRA VARIABLE O EN LA MISMA CAJA DE TEXTO.
Next I
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar

RE:problemas con la sintaxsis del UPDATE

Publicado por ismael (28 intervenciones) el 04/01/2005 11:47:43
Prueba con el format:

SQL = "UPDATE Clientes SET NPr = 28,
Importe =" + format(tximporte.text,"###.00") + "
WHERE Provincia = 'Madrid'"
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar

RE:problemas con la sintaxsis del UPDATE

Publicado por ferjai (4 intervenciones) el 05/01/2005 09:55:45
Yo, mas que modificar el textbox, obligaría a que el usuario metiese en txtimporte sólo valores numéricos.

Private Sub txtimporte_KeyPress(KeyAscii As Integer)
If (Chr(KeyAscii) < "0" Or Chr(KeyAscii) > "9") And Chr(KeyAscii) <> "," And KeyAscii <> vbKeyBack Then
KeyAscii = 0
End If
End Sub
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar