title: How to retrieve data from Access Database, when user are login to the program?
body: <p>to all my senior. I'm doing an assignment about Music Sales System. </p>
  
  <p>When the system begin will start a form "Login.vb", it allow the user to login with Staff ID and Password. After that, if login successful it will show the name of the staff in a textbox.</p>
  
  <p>Could any senior help me or teach me how to retrieve the name when the staff login to the system?</p>
  
  <p>Furthermore, I also like to retrieve picture from Access Database, hope can get some help from here.</p>
  
  <p>I'm using Jet.Oledb.4.0.</p>
  
  <p>Thank You.</p>
  
  <p>Below is my Login.vb code</p>
  
  <p>Private Sub btnLogin_Click(sender As Object, e As EventArgs) Handles btnLogin.Click</p>
  
  <pre><code>    Dim Connection As New Data.OleDb.OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=Music_Sales_Database.mdb;")
      Dim Command As New Data.OleDb.OleDbCommand("SELECT [Staff_ID] FROM [Staff] WHERE [Staff_IDField] = Staff_ID AND [PasswordField] = Password", Connection)
  
      Dim StaffIDParam As New Data.OleDb.OleDbParameter("Staff_ID", Me.txtStaff_ID.Text)
      Dim PasswordParam As New Data.OleDb.OleDbParameter("Password", Me.txtPassword.Text)
  
      Command.Parameters.Add(StaffIDParam)
      Command.Parameters.Add(PasswordParam)
  
      Command.Connection.Open()
  
      Dim Reader As Data.OleDb.OleDbDataReader = Command.ExecuteReader()
  
      If txtStaff_ID.Text = "" Then
          MessageBox.Show("Staff ID and Password cannot be empty, please try again.", "Login Failed", MessageBoxButtons.OK, MessageBoxIcon.Asterisk)
      ElseIf txtPassword.Text = "" Then
          MessageBox.Show("Staff ID and Password cannot be empty, please try again.", "Login Failed", MessageBoxButtons.OK, MessageBoxIcon.Asterisk)
      ElseIf Reader.HasRows Then
          MessageBox.Show("You are authenticated.", "Login Successful", MessageBoxButtons.OK, MessageBoxIcon.Asterisk)
          MyPlayer.SoundLocation = path &amp; LogOnSound
          MyPlayer.Play()
          txtPassword.Text = ""
          Me.Hide()
          Main_System.Show()
  
      Else
          MessageBox.Show("Invalid Staff ID or Password, please try again.", "Login Failed", MessageBoxButtons.OK, MessageBoxIcon.Error)
          txtPassword.Text = ""
          txtPassword.Focus()
      End If
  
      Command.Connection.Close()
  End Sub
  </code></pre>
  
  <p><em><strong></em>**<em>*</em>**</strong>*BELOW is the program that Im coding, but still coding.......coz Im still new in VB.....hope can get some help</p>
  
  <pre><code>Dim Connection As New OleDb.OleDbConnection
  Dim Command As OleDb.OleDbCommand
  Dim Reader As OleDb.OleDbDataReader
  Dim DBPath As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=Music_Sales_Database.mdb;"
  Dim Image() As Byte
  
  Private Sub RetrieveStaffInformation()
  Connection.ConnectionString = DBPath
  Connection.Open()
  
  Command = Connection.CreateCommand
  Command.CommandText = "SELECT        Staff.* FROM            Staff"
  
  Reader = Command.ExecuteReader
  
  Image = CType(Reader(0), Byte())
  Dim MS As New System.IO.MemoryStream(Image)
  Dim bmImage As New Bitmap(MS)
  
  picStaff.Image = bmImage
  picStaff.Refresh()
  End Sub
  </code></pre>