para busquedas numericas como se escribe:eccvec = \'" & Clave & "\'"
o con dos comillas o como.,
Clave = InputBox("Introduzca el numero del encargado a buscar", " BUSCAR ENCARGADO", "Escriba aquí")
bus = "select * from encargado where eccvec = '" & Clave & "'"
la variable clave la declaro como entero?...
Clave = InputBox("Introduzca el numero del encargado a buscar", " BUSCAR ENCARGADO", "Escriba aquí")
bus = "select * from encargado where eccvec = '" & Clave & "'"
la variable clave la declaro como entero?...
Sin comillas
Clave = InputBox("Introduzca el numero del encargado a buscar", " BUSCAR ENCARGADO", "Escriba aquí")
If IsNumeric(Clave) Then
bus = "select * from encargado where eccvec = " & Clave
End If
Salu2
sdemingo
Clave = InputBox("Introduzca el numero del encargado a buscar", " BUSCAR ENCARGADO", "Escriba aquí")
If IsNumeric(Clave) Then
bus = "select * from encargado where eccvec = " & Clave
End If
Salu2
sdemingo
Como a veces se usan variables numéricas en lugar de textboxs para pasar parámetros a consultas SQL, yo prefiero hacer esto:
bus = "select * from encargado where eccvec = " & cstr(Clave)
Cstr convierte un numérico en string
Saludos
bus = "select * from encargado where eccvec = " & cstr(Clave)
Cstr convierte un numérico en string
Saludos
Hola Baltasar,
solo por curiosidad....
¿no funcionaría igual sin convertirla a String si el campo en la BD es de tipo numérico?
Es decir,
Dim clave as integer
clave = 123
bus = "select * from encargado where eccvec = " & clave
si eccvec está definido como numérico.
Salu2
sdemingo
solo por curiosidad....
¿no funcionaría igual sin convertirla a String si el campo en la BD es de tipo numérico?
Es decir,
Dim clave as integer
clave = 123
bus = "select * from encargado where eccvec = " & clave
si eccvec está definido como numérico.
Salu2
sdemingo
