SqlDataSource UpdateCommand problem

  • Thread starter Thread starter David C
  • Start date Start date
D

David C

I have aspx web page with a GridView that displays data from a SqlDataSource
view that combines 2 tables to show information. It has an Edit feature and
the SqlDataSource has an UpdateCommand text to run a stored proc that has 2
UPDATE statements (1 for each table) as shown below. When I click the
Update link button in Edit mode, the 2nd table changes but not the 1st
table. I have tested the stored proc manually and both tables update fine.
Can someone help with this? Thanks.

David

<asp:SqlDataSource ID="SqlvwPeoplePropLink" runat="server"

ConnectionString="<%$ ConnectionStrings:RFPDataConnectionString %>"

DeleteCommand="DELETE FROM [PeoplePropLink] WHERE [PropLinkID] =
@PropLinkID"

SelectCommand="SELECT [PropLinkID], [PersonID], [RoleID], [RoleName],
[ContactName], [Phone], [CellPhone], [EmailLink], (e-mail address removed)
 
Found the answer. The GridView only had DatakeyNames for the 2nd table.
Once I added key for 1st table the update worked. Not sure why...maybe
someone can explain.

David
 
Back
Top