gridview edit mode question

C

cheeseistheman

Hello there,

I am fairly new to ASP.NET and have been using the data access tutorials at
www.asp.net to get an understanding of some of the basic data access
concepts. I have created a page that uses a detailsview to insert records
into a table and a gridview to edit and delete existing records, so far so
good.

The one problem I have encountered that I have not figured out has to do
with editing records. If another user inserts a record into the table before
I click the edit button the gridview puts the wrong record in editmode ie.

My gridview currently contains the records:

200 Jones
300 Peters
400 Andrews

Another user inserts the following record before I click edit:

100 Walters

I then click the edit button for the record that corresponds to "200 Jones"
(which is the record I want to edit). Once I do this the gridview places the
"100 Walters" record in edit mode. I'm sure I'm missing a faily basic concept
here but if anyone has a suggestion for me I'd definitely appreciate it.
Thanks.
 
P

pendo

you have to limit to only updating the particular record. for instance in
your wheree clauses say

where primarykey = @primarykey
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,743
Messages
2,569,478
Members
44,899
Latest member
RodneyMcAu

Latest Threads

Top