Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27554

Problem with show datas from access data base to labels

$
0
0
Hello,

I have a problem I need to show datas from an access data base to labels, which it works.

The problem is that if I choose one register it will appear but the next it does not appear, it seems to be stick into the first query.

This is my code. What I need is to make appear show the next datas.

Code:

Private Sub BTBuscar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BTBuscar.Click
        If Not Conex.State = ConnectionState.Open Then
            Conex.Open()
        End If
        If Not TXTBusquedaDB.Text = "" Then
            Try

                Dim query As String = ("SELECT nombre,apellido,direccion,telefono,email from CLIENTE where Cod_cliente=" & TXTBusquedaDB.Text & "")
                adap = New OleDbDataAdapter(query, Conex)
                adap.Fill(dt)

                TXTNombre.Text = dt.Rows(0)(0).ToString()
                TXTApellidos.Text = dt.Rows(0)(1).ToString()
                TXTDireccion.Text = dt.Rows(0)(2).ToString()
                TXTTelefono.Text = dt.Rows(0)(3).ToString()
                TXTemail.Text = dt.Rows(0)(4).ToString()
                Conex.Close()
            Catch ex As Exception
                MsgBox("Registro no existe" & Chr(13) & "Puede comprobar los registros a traves de la lista", MsgBoxStyle.Information, vbOK)
            End Try

        ElseIf TXTBusquedaDB.Text = "" Then
            TXTBusquedaDB.Text = ""
        End If
        Conex.Close()
    End Sub

Thank you,

Viewing all articles
Browse latest Browse all 27554

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>