Foros del Web » Programación para mayores de 30 ;) » Programación General » Visual Basic clásico »

(ayuda) No Me Muestra Datos De Una Consulta Con Db Mysql

Estas en el tema de (ayuda) No Me Muestra Datos De Una Consulta Con Db Mysql en el foro de Visual Basic clásico en Foros del Web. BUENAS GENTE, LES KERIA CONSULTAR PORKE ME SUSEDE LO SIGUIENTE, TENGO DOS TABLAS (CHARACTERS Y MERCHANT_BUYLISTS) CUANDO HAGO UN SELECT * FROM CHARACTERS NO HAY ...
  #1 (permalink)  
Antiguo 16/01/2006, 13:04
Avatar de aldo1982  
Fecha de Ingreso: noviembre-2004
Ubicación: Santa Fe (Argentina) Colon F.C
Mensajes: 1.362
Antigüedad: 19 años, 5 meses
Puntos: 6
(ayuda) No Me Muestra Datos De Una Consulta Con Db Mysql

BUENAS GENTE, LES KERIA CONSULTAR PORKE ME SUSEDE LO SIGUIENTE, TENGO DOS TABLAS (CHARACTERS Y MERCHANT_BUYLISTS) CUANDO HAGO UN SELECT * FROM CHARACTERS NO HAY PROBLEMAS LUEGO MUESTRO EN UN LIST Y ME LO HACE PERFECTO, PERO EL TEMA ES KE HAGO LO MISMO Y NO ME MUESTRA ABSOLUTAMENTE NADA DE LA TABLA MERCHANT_BUYLISTS, BUE ACA LES DEJO EL CODIGO A VER SI ME PUEDEN DAR UNA MANITOP

ACLARACION: LA TABLA MERCHANT_BUYLIST TIENE UN CAMPO KE SE LLAMA PRICE Y TIENE UNOS 1000 REGISTROS (LA TABLA CAHRACTERS TIENE UNOS 100 REGISTROS)..BUE ACA DEJO EL CODIGO

`PARTE GENERAL
Public rs As ADODB.Recordset
Public cxnfac As ADODB.Connection


'EN UN BOTON PARA KE CARGUE LOS PRECIOS
Private Sub Command1_Click()
Set cxnfac = New ADODB.Connection
cxnfac.ConnectionString = "Driver={MySQL ODBC 3.51 Driver};Server=localhost;Port=3306;Option=131072;S tmt=;Database=l2jdb;" & "uid=" & Form1.Text1 & ";" & "pwd=" & Form1.Text2 & ";"
cxnfac.Open

SQL = "select distinct merchant_buylists.price AS price from merchant_buylists"
'where name like '" & Text1.Text & "' "
Set rs = cxnfac.Execute(SQL, , adCmdText)

Do While Not rs.EOF
List1.AddItem rs!price
rs.MoveNext
Loop
rs.Close

BUE GENTE SALU2 Y GRACIAS
__________________
LA MUERTE ESTÁ TAN SEGURA DE VENCER QUE NOS DA TODA UNA VIDA DE VENTAJA
  #2 (permalink)  
Antiguo 16/01/2006, 14:52
Avatar de GeoAvila
Colaborador
 
Fecha de Ingreso: diciembre-2003
Ubicación: Antigua Guatemala
Mensajes: 4.032
Antigüedad: 20 años, 4 meses
Puntos: 53
veo que te faltan unos %% antes en la busqueda con el like

'where name like '%" & Text1.Text & "%' "

nos vemos..
__________________
* Antes de preguntar lee las FAQ, y por favor no hagas preguntas en las FAQ
Sitio http://www.geoavila.com twitter: @GeoAvila
  #3 (permalink)  
Antiguo 16/01/2006, 20:52
Avatar de jc_moty  
Fecha de Ingreso: septiembre-2005
Ubicación: Usulután, El Salvador
Mensajes: 477
Antigüedad: 18 años, 7 meses
Puntos: 1
Cita:
Iniciado por aldo1982
SQL = "select distinct merchant_buylists.price AS price from merchant_buylists"
'where name like '" & Text1.Text & "' "
Proba así:
Código:
SQL = "select distinct merchant_buylists.price AS price from merchant_buylists where name like '" & Text1 & "%'"
Espero te sirva
  #4 (permalink)  
Antiguo 18/01/2006, 12:02
Avatar de aldo1982  
Fecha de Ingreso: noviembre-2004
Ubicación: Santa Fe (Argentina) Colon F.C
Mensajes: 1.362
Antigüedad: 19 años, 5 meses
Puntos: 6
wenas, gracias por la respuesta .. mi pregunta es .. porke me hace la consulta sin los % a otras tablas ? .. moty esa forma ke tu me dices ya la probe y es exactamente lo mismo gracias de todas formas

salu2
__________________
LA MUERTE ESTÁ TAN SEGURA DE VENCER QUE NOS DA TODA UNA VIDA DE VENTAJA
  #5 (permalink)  
Antiguo 18/01/2006, 12:04
Avatar de aldo1982  
Fecha de Ingreso: noviembre-2004
Ubicación: Santa Fe (Argentina) Colon F.C
Mensajes: 1.362
Antigüedad: 19 años, 5 meses
Puntos: 6
bueps no se ke mas hacer sigue sin mostrarme datos :S
ahora probe sin el where como para ke me muestre todos los datos pero ni medio de bola ke me da .. bue aca pongo el codigo pa ke vean


Private Sub Command1_Click()
Set cxnfac = New ADODB.Connection
cxnfac.ConnectionString = "Driver={MySQL ODBC 3.51 Driver};Server=localhost;Port=3306;Option=131072;S tmt=;Database=l2jdb;" & "uid=" & Form1.Text1 & ";" & "pwd=" & Form1.Text2 & ";"
cxnfac.Open

SQL = "select price from merchant_buylists"

Set rs = cxnfac.Execute(SQL, , adCmdText)

Do While Not rs.EOF
List1.AddItem rs!price
rs.MoveNext
Loop
rs.Close

End Sub
__________________
LA MUERTE ESTÁ TAN SEGURA DE VENCER QUE NOS DA TODA UNA VIDA DE VENTAJA
  #6 (permalink)  
Antiguo 18/01/2006, 13:40
Avatar de Mapachita2807  
Fecha de Ingreso: enero-2006
Mensajes: 15
Antigüedad: 18 años, 3 meses
Puntos: 0
A mi me pasaba eso cuando trataba de darle los valores por propiedades a las listas, y no de la forma "Artesanal"... prueba antes del Do While poniendo un rs.MoveFirst, y revisa si en realidad necesitas el rs.MoveNext
Esop, espero que sea de ayuda
__________________
:corazon: Prefiero solo un día, pero contigo, que todos los días del resto de mi vida sin ti... Te Amo Cristobalin :borracho: :corazon:
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 09:22.