SqlDataSource UpdateCommand problem

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)
 
D

David C

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
 

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,768
Messages
2,569,575
Members
45,053
Latest member
billing-software

Latest Threads

Top