Hi
I am creating an MDI application that carries out various tasks >> Login, View Balance, Show Transactions, Request Statement.
So far I have only managed to create the Parent MDI, Main menu to be able to choose a function, and login validation.
Login Code:
Dim str As String = "Provider = Microsoft.jet.OLEDB.4.0;Data Source =C:\....\bin\CustomerDetails.mdb"
Dim conn As New OleDb.OleDbConnection(str)
Private Sub btnLogin_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnLogin.Click
Dim cmd As New OleDb.OleDbCommand("select * from SecurityTable where AccountNo='" + txtAccountNo.Text + "'", conn)
conn.Open()
Try
Dim rdr As OleDb.OleDbDataReader = cmd.ExecuteReader
If rdr.Read Then
Dim p As String = rdr(1)
If txtPassword.Text = p Then
MessageBox.Show("Welcome !!")
Me.Close()
Else
MsgBox(" Invalid Password!! Please try again ")
txtPassword.Text = ""
txtPassword.Focus()
End If
Else
MsgBox(" Invalid Username!! Please try again ")
txtAccountNo.Text = ""
txtPassword.Text = ""
txtAccountNo.Focus()
End If
conn.Close()
Catch ex As Exception
MsgBox(ex.Message)
conn.Close()
End Try
End Sub
The above code works successfully. It retrieves data from MS Access Security Table and allows the user to access the main menu commands in the Parent form.
The PROBLEM that I have now is in retrieving specific records/fields for that particular user that is logged in.
For example, I have created a form named Balance which is displayed once the miViewBalance is clicked. In it I want to show in a label or TextBox the Name, Surname and Balance for that specific user.
I already have a MS Access Table that contains the details such as name, surname, address, account type, etc. All I want is to display some fields in the Balance Form.
CAN ANYBODY HELP ME WITH THE CODE PLEASE?:S
Code for retrieving data from Access and displaying it in label or Textbox for the specific user that is logged in the application.