Ver Mensaje Individual
  #1 (permalink)  
Antiguo 20/11/2008, 16:26
sabruchi
 
Fecha de Ingreso: junio-2006
Mensajes: 166
Antigüedad: 17 años, 11 meses
Puntos: 3
consulta mysql

hola de nuevo!! al hacer una consulta a mysql, me muestra solo el primer campo no todos nose por que, ademas quisiera saber como agregar un mensaje de error si no encuentra ningun campo. gracias!!!
tengo el siguiente codigo en vb6

Public BD As ADODB.Connection
Public RecSQL As ADODB.Recordset

Private Sub Command1_Click()

On Error GoTo Ver

Set BD = New ADODB.Connection
BD.ConnectionString = "driver={MySQL ODBC 3.51 Driver};" & _
"Server=" & Text1 & ";" & _
"Port=" & Text2 & ";" & _
"Database=" & Text3 & ";" & _
"User=" & Text4 & ";" & _
"Password=" & Text5 & ";" & _
"Option=3;"

BD.Open

MsgBox "Conexión establecida!!!", vbExclamation, "Conexión"

Exit Sub
Ver:
MsgBox "Nº de error: " & Err.Number & " | " & Err.Description, vbCritical, "Control de errores"
Err.Clear
End Sub


Private Sub Command2_Click()
On Error GoTo Ver

Set RecBD = New ADODB.Recordset
RecBD.Open "select * from categories", BD, adOpenStatic, adLockOptimistic

Text6.Text = RecBD.Fields("id")
Text7.Text = RecBD.Fields("name")


Exit Sub
Ver:
MsgBox "Nº de error: " & Err.Number & " | " & Err.Description, vbCritical, "Control de errores"
Err.Clear

End Sub