Hey all!

First off, yes i have read the tutorial and i'm still stuck (mainly cos i'm not using ADOOB).

My main problem is that my code adds a new record to the end of the dataset, which is what i want, but then it also has the very annoying side affect of overwriting the first record in the dataset too.

I've had a look at many other forums where this same question has been posed, and when i try implement the code, either it gives me errors, does the same thing as my code does, or complains that the record already exists (which it doesn't).

The user must first click on the "Clear Current Record" which purely sets the values of the textboxes on the form to null, thus allowing the user to input new values, and then unlocks the "Add new record" (this button is locked to prevent users from adding the current record being viewed, which would cause errors as the record already exists).

Here is the code for the "Add new record" button:

Private Sub CmdAdd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CmdAdd.Click
        Dim dataR As payrollDatabaseDataSet.Allowances_Pay_TableRow
        dataR = PayrollDatabaseDataSet.Allowances_Pay_Table.NewRow

        ' fill variables
        dataR.employee_ID = Employee_IDTextBox.Text
        dataR.allowances_ID = Allowances_IDTextBox.Text
        dataR.allowances_amount = Allowances_amountTextBox.Text

        ' update records
        PayrollDatabaseDataSet.Allowances_Pay_Table.Rows.Add(dataR)
        Allowances_Pay_TableTableAdapter.Update(PayrollDatabaseDataSet.Allowances_Pay_Table)

        ' display first record in(database)
        current_row = 0
        ShowCurrentRecord()
    End Sub

Any help would be much apprecuated.

My second problem is that after i close the vb program, changes that i've made to the records don't stay changed. my database object's properties (in vb) are set as "Build Action: Compile" and "Copy to output directory: copy always" so i don't really understand why it is doing this.

Thanks
Laura

i'm still stuck (mainly cos i'm not using ADOOB).

Then, use it ;).

Frankly, I couldn't find out the solution to your problem from your post. Post the entire code if possible/feasible.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.