Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / August 2007

Tip: Looking for answers? Try searching our database.

SqlDataSource UpdateCommand problem

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
David C - 24 Aug 2007 18:35 GMT
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], [Email], [PropertyRole],
[LinkNotes], [PrimaryPerson] FROM [vw_PeoplePropLink] WHERE [PropertyID] =
@QSPropID"

UpdateCommand="EXEC rfp_updPeopleAndLink @Phone, @CellPhone, @Email,
@PersonID, @LinkNotes, @PrimaryPerson, @PropLinkID">

<DeleteParameters>

<asp:Parameter Name="PropLinkID" Type="Int32" />

</DeleteParameters>

<UpdateParameters>

<asp:Parameter Name="PersonID" Type="Int32" />

<asp:Parameter Name="RoleID" Type="Int32" />

<asp:Parameter Name="RoleName" Type="String" />

<asp:Parameter Name="PropLinkID" Type="Int32" />

<asp:Parameter Name="Phone" Type="String" />

<asp:Parameter Name="CellPhone" Type="String" />

<asp:Parameter Name="Email" Type="String" />

<asp:Parameter Name="LinkNotes" Type="String" />

<asp:Parameter Name="PrimaryPerson" Type="Boolean" />

</UpdateParameters>

<InsertParameters>

<asp:Parameter Name="PersonID" Type="Int32" />

<asp:Parameter Name="RoleID" Type="Int32" />

<asp:Parameter Name="RoleName" Type="String" />

</InsertParameters>

<SelectParameters>

<asp:QueryStringParameter Name="QSPropID" QueryStringField="p" Type="Int32"
/>

</SelectParameters>

</asp:SqlDataSource>
David C - 24 Aug 2007 19:03 GMT
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
>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
[quoted text clipped - 67 lines]
>
> </asp:SqlDataSource>

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.