who know how to make data show at textbox from this code.
from the below code, i only can check if that data got in database or not, if got it show a msgbox.
but i want the all data show at text..

example
i search data use a NoIC data..

my database got Name, NoIC, Age, Country..(in 1 table)
i want that Name, Age and coutry data show up at my textbox.


please someone help me..
i need finish my project.

Private Sub btnCari_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCari.Click

        Dim ConString As String = "Provider=Microsoft.Jet.OLEDB.4.0;Password="""";User ID=Admin;Data Source=""H:\PROJEK\New Sistem\SISTEM_DATABASE.mdb"";"
        ' string declare connection ke dbase
        Dim DBCon As New OleDb.OleDbConnection(ConString)
        Dim g_login As String
        ' global decalration
        g_login = Me.txtNoIC.Text

        If g_login = "" Then
            MessageBox.Show("Your information is not complete.", "Missing Info")
            Me.txtNoIC.Focus()
            Return
        End If

        Dim strsql As String = "SELECT * FROM RekodAnggaran WHERE [NoIC]='" & txtNoIC.Text & "'"
        Dim cmd As New OleDb.OleDbCommand(strsql, DBCon)
        Dim dr As OleDb.OleDbDataReader
        Dim valid As Boolean = False
        Dim HasRows As Boolean = False
        Try
            DBCon.Open()
            dr = cmd.ExecuteReader
            If dr.HasRows Then
                While dr.Read
                    If g_login = dr.Item("NoIC") Then
                        valid = True
                        MsgBox("Ada Rekod!!")
                    End If
                End While
                HasRows = True
            End If
            dr.Close()
        Catch exO As OleDb.OleDbException
            MessageBox.Show(exO.Message)
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        Finally
            If DBCon.State = ConnectionState.Open Then
                DBCon.Close()
            End If
            cmd = Nothing
            dr = Nothing
            DBCon.Dispose()
            GC.Collect()
        End Try

    End Sub

i already solved it..

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.