CallumJames
New member
- Joined
- Dec 13, 2012
- Messages
- 2
- Programming Experience
- Beginner
Below is my log-in procedure coded in VB 2010 Express. I'm new to programming so this might be an easy solution for somebody.
I've got this procedure in 3 forms, yet only 1 out of the 3 forms work. The code has been copy and pasted from the one form to the other, with the only change being the database that the username and password is being picked up from is "Customer" instead of "Employee". I've checked the table names in my database (Microsoft Access) which is "Employee" and as you can see it is also spelt correctly in the code.
The error message I keep receiving is: OleDbException was unhandled. No value given for one or more required parameters - on the following line of code:
Been reading lots of other threads with similar problems yet I still can't see what's wrong. Would really appreciate if anybody has a solution.
Thanks In Advanced!
(not sure if there was an easier way to do this but I manually coloured the text as it's displayed in VB so it's easier to read)
I've got this procedure in 3 forms, yet only 1 out of the 3 forms work. The code has been copy and pasted from the one form to the other, with the only change being the database that the username and password is being picked up from is "Customer" instead of "Employee". I've checked the table names in my database (Microsoft Access) which is "Employee" and as you can see it is also spelt correctly in the code.
The error message I keep receiving is: OleDbException was unhandled. No value given for one or more required parameters - on the following line of code:
VB.NET:
Private Sub frmEmployeeHomepage_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
Me.EmployeeTableAdapter.Fill(Me.BridgendBingoHouseDataSet.Employee)
End Sub
Been reading lots of other threads with similar problems yet I still can't see what's wrong. Would really appreciate if anybody has a solution.
Thanks In Advanced!
VB.NET:
Private Sub frmEmployeeHomepage_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
Me.EmployeeTableAdapter.Fill(Me.BridgendBingoHouseDataSet.Employee)
End Sub
Private Sub btnSubmit_Click(sender As System.Object, e As System.EventArgs) Handles btnSubmit.Click
Dim Found As Boolean
'total number of rows in the table.
Dim TotalNumberRows As Integer
'row number, starting at zero.
Dim Rowcount As Integer
'username picked up from current record in database.
Dim Username As String
'password picked up from current record in database.
Dim Password As String
TotalNumberRows = BridgendBingoHouseDataSet.Employee.Rows.Count()
EmployeeBindingSource.MoveFirst()
Rowcount = 0
Found = False
Do Until Rowcount = (TotalNumberRows) Or Found = True
'looping the tables for usernames & passwords.
Username = BridgendBingoHouseDataSet.Employee.Rows(Rowcount).Item("EmployeeUsername")
Password = BridgendBingoHouseDataSet.Employee.Rows(Rowcount).Item("EmployeePassword")
'checking the database if the input username and password is the same.
If txtCustomerInformationUsername.Text = Username And txtCustomerInformationPassword.Text = Password Then
MsgBox("Log in was successful")
frmPlay.Show()
Me.Close()
Found = True
End If
Loop
If Found = False Then
'If the username and password entered does not match the database then display error message
MsgBox("Invalid Username or Password")
End If
End Sub
End Class
(not sure if there was an easier way to do this but I manually coloured the text as it's displayed in VB so it's easier to read)
Last edited: