Hello,
I have a simple webform that allows users to navigate through the items in a database. The item is displayed via a single textbox and the user clicks on next, previous, first and last buttons to navigate.
I also have an update record button that should allow the user to navigate to a record, change the record displayed in the textbox, click on the update button and have the changes saved to the database.
I have tried this but what is happening is that when i change the text of the record, it changes ok and i see the confirmaion message I have set.
However, when i navigate away and then back again i see the changed record which is fine, and also the original record that should have been overwritten by changes is also there.
When i look at my backend access database i also notice that the updated record has taken the place of another record in the table.
So to sum up, i am changing the record, clicking update, and then navigating up and down again only to notice that my updated record appears as a new record that has overwritten anothe unrelated record but has left the original there.
Here is my code for the update button:
Anyone have any ideas or alternatives ways i could use??
I have a simple webform that allows users to navigate through the items in a database. The item is displayed via a single textbox and the user clicks on next, previous, first and last buttons to navigate.
I also have an update record button that should allow the user to navigate to a record, change the record displayed in the textbox, click on the update button and have the changes saved to the database.
I have tried this but what is happening is that when i change the text of the record, it changes ok and i see the confirmaion message I have set.
However, when i navigate away and then back again i see the changed record which is fine, and also the original record that should have been overwritten by changes is also there.
When i look at my backend access database i also notice that the updated record has taken the place of another record in the table.
So to sum up, i am changing the record, clicking update, and then navigating up and down again only to notice that my updated record appears as a new record that has overwritten anothe unrelated record but has left the original there.
Here is my code for the update button:
VB.NET:
[SIZE=2][COLOR=#0000ff]Private[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Sub[/COLOR][/SIZE][SIZE=2] btnUpdate_Click([/SIZE][SIZE=2][COLOR=#0000ff]ByVal[/COLOR][/SIZE][SIZE=2] sender [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2] System.Object, [/SIZE][SIZE=2][COLOR=#0000ff]ByVal[/COLOR][/SIZE][SIZE=2] e [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2] System.EventArgs) [/SIZE][SIZE=2][COLOR=#0000ff]Handles[/COLOR][/SIZE][SIZE=2] btnUpdate.Click[/SIZE]
[SIZE=2]
[/SIZE][SIZE=2][COLOR=#0000ff]Dim[/COLOR][/SIZE][SIZE=2] cb [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]New[/COLOR][/SIZE][SIZE=2] OleDb.OleDbCommandBuilder(davendors)[/SIZE]
[SIZE=2]
dsvendors.Tables("Vendors").Rows(inc).Item(1) = txtVendor.Text
davendors.Update(dsvendors, "Vendors")
lblmessage.Text = "The Record has been updated to " & txtVendor.Text
[/SIZE][SIZE=2][COLOR=#0000ff]End[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Sub[/COLOR][/SIZE]
Anyone have any ideas or alternatives ways i could use??