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. . .