Visual Basic - Ayuda LIKE

Life is soft - evento anual de software empresarial
 
Vista:

Ayuda LIKE

Publicado por mary (58 intervenciones) el 28/05/2007 14:56:31
tengo este codigo
Dim db As ADODB.Connection
Set db = New ADODB.Connection
Set rs = New ADODB.Recordset
db.ConnectionString = "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=Confederado;DataSource=."
db.Open
If txtApellido.Text <> "" Then
Refrescar_Grid
sql = "SELECT Cedula,Num_Telefonico,Proveedor,Apellido,Nombre,Direccion,Fecha_Activacion FROM Tarjetas LIKE Apellido='" & txtApellido.Text & "'*"
Set rs = db.Execute(sql)
With MSFlexGrid1
.CellAlignment = 9
X = 0
Do While Not rs.EOF
X = X + 1
.TextMatrix(X, 0) = rs!Cedula
.TextMatrix(X, 1) = rs!Nombre
.TextMatrix(X, 2) = rs!Apellido
.TextMatrix(X, 3) = rs!Num_Telefonico
.TextMatrix(X, 4) = rs!Proveedor
.TextMatrix(X, 5) = rs!Fecha_Activacion
.TextMatrix(X, 6) = rs!Direccion
rs.MoveNext
Loop
End With

y quiero me muestre en el grid todos los registroa q empiecen por la letra que introduzca en el textbox, pero me da un error "Sintaxis incorrecta", podrian ayudarme po favor
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:Ayuda LIKE

Publicado por Luisana (1 intervención) el 28/05/2007 16:18:26
prueba con los simbolos "+" para concatenar

te quedaria algo asi

sql = "SELECT Cedula,Num_Telefonico,Proveedor,Apellido,Nombre,Direccion,Fecha_Activacion FROM Tarjetas LIKE Apellido='" + txtApellido.Text + "'"
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:Ayuda LIKE

Publicado por mary (58 intervenciones) el 28/05/2007 16:33:56
Ya consegui la solucion, probe con % y funciono, gracias de todas formas
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