hey guys, im having a little problem here.
here's my code so far:

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        con = New SqlConnection("Data Source=.\SQLExpress;Integrated Security=true; AttachDbFilename=C:\Users\Carlo\Documents\Visual Studio 2008\Projects\OTTO Payroll System\OTTO Payroll System\OTTOdBase.mdf;User Instance=true")
        con.Open()

            Try

                If CType(Me.ACCESSTableAdapter.ScalarQuery1(Me.UserBox.Text, _
                         Me.PassBox.Text, Me.PosBox.SelectedItem), Integer) > 0 Then
                    If PosBox.SelectedItem = "Administrator" Then
                        Dim form As New Form2
                        form = New Form2
                        Form2.Show()
                        Me.Hide()
                    ElseIf PosBox.SelectedItem = "Accountant" Then
                        Dim form As New Form3
                        form = New Form3
                        Form3.Show()
                        Me.Hide()
                    ElseIf PosBox.SelectedItem = "Employee" Then

                    com = New SqlCommand("Select * from EMPLOYEE", con)
                    dr = com.ExecuteReader()
                    Form4.Show()
                    While dr.Read()
                        Form4.Label1.Text = (dr(0).ToString())
                        Form4.Label2.Text = (dr(1).ToString())
                        Form4.Label3.Text = (dr(2).ToString())
                    End While

                    ElseIf PosBox.SelectedItem = "" Then
                        MessageBox.Show("Please select a position", "Choose a position", MessageBoxButtons.OK, MessageBoxIcon.Information)

                    End If
                Else
                    MsgBox("Invalid Username/Password and/or No Position Selected.")

                End If
            Catch ex As Exception
                MsgBox(ex.ToString)
            End Try

    End Sub

what i wanted to do is, when an "employee" access the system by logging in, a form will show showing his record. my problem is that, whatever employee account i use, the same information are being displayed on form 4 which is the first record on the database. i want the form4 to display the records of whatever employee account i use. pls help me. . .

You need a unique identifier all your doing is selecting the entire database. you need something like

com = New SqlCommand("Select * from EMPLOYEE", con) Where emp_id = 'session.id'

I see.
But what do you actually mean by 'session.id'?
Would I be using the exact same code that you typed or do I need to make my own identifier?

And if I were to make my own identifier, will it come from the database? For example, if the Emp_ID is 1001, would 1001 be the identifier?

Why don't use dataset, and dataset's query wizards? It is much simplier to make SQL queries.
It seems you don't have SQL knowledges, so I hardly suggest you to use dataset wizards.

This article has been dead for over six months. Start a new discussion instead.