Hey guys
I'm pretty close to finishing this payroll program, but i've run in to yet some more problems and i can't figure out how to fix them.
So, i have various forms representing different tables of my database (Access - the database is connected to my vb application as a data source)
Take for instance the employee table. You can add and delete records from the table as well as make changes to the fields. The add and delete buttons on my form work properly, and if i go to the 2nd record upwards, the save button works, but when i try update the first record, the changes don't stick.
Here is a code snippet. This one is from the Save button for a table called Allowances pay.
' save current record
' variables to store records
Dim row, datar2 As payrollDatabaseDataSet.Allowances_Pay_TableRow
row = PayrollDatabaseDataSet.Allowances_Pay_Table.Rows(current_row)
datar2 = PayrollDatabaseDataSet.Allowances_Pay_Table.Rows(0)
' user must confirm the edit
Dim confirm AsInteger
confirm = MsgBox("Are you sure you want to alter this record", 1 + 48, "Please Confirm")
If confirm = 1 Then
' get new values for variables
row.employee_ID = CStr(Employee_IDTextBox.Text)
row.allowances_ID = Allowances_IDTextBox.Text
row.allowances_amount = Allowances_amountTextBox.Text
Else : MsgBox("Action cancelled!")
EndIf
' update record
Allowances_Pay_TableTableAdapter.Update(row)
Allowances_Pay_TableTableAdapter.Update(PayrollDatabaseDataSet.Allowances_Pay_Table)
I put in a breakpoint just before the update section of the code and checked the values for row.employee_id, etc. The values stored in them are all correct, so i presume it must be the way i'm calling the update procedure.
I'd appreciate any help with this
Thanks
Laura