Advertisement

06.26.2008 at 01:56PM PDT, ID: 23519864
[x]
Attachment Details

GridView 'Edit' updates data in all rows of the table instead of just the selected row

Asked by pzabel in .NET Framework 2.0, Programming for ASP.NET, SQL Query Syntax

Tags: ASP.NET, C#, SQL, GridView

I have a GridView using a SqlDataSource.  I am trying to use the built in Edit feature of the GridView to update the single selected row.  However, when I edit one of the fields, it changes the values for that column in all the rows of the table instead of just the selected row I am editing.

Here is the SQL qeury I am using:

UPDATE    Inventory
SET           Amount = @amount, EntryDate = @entrydate
WHERE     InventoryId = InventoryId

InventoryId is the primary key for that table.  Any thoughts?  Thanks guysStart Free Trial
[+][-]06.26.2008 at 01:58PM PDT, ID: 21878962

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: .NET Framework 2.0, Programming for ASP.NET, SQL Query Syntax
Tags: ASP.NET, C#, SQL, GridView
Sign Up Now!
Solution Provided By: raterus
Participating Experts: 1
Solution Grade: B
 
 
[+][-]06.26.2008 at 02:06PM PDT, ID: 21879026

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]06.26.2008 at 02:11PM PDT, ID: 21879071

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]06.26.2008 at 02:32PM PDT, ID: 21879228

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628