473,796 Members | 2,669 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

SqlDataSource UpdateCommand problem

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:SqlDataSou rce ID="SqlvwPeople PropLink" runat="server"

ConnectionStrin g="<%$ ConnectionStrin gs:RFPDataConne ctionString %>"

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

SelectCommand=" SELECT [PropLinkID], [PersonID], [RoleID], [RoleName],
[ContactName], [Phone], [CellPhone], [EmailLink], [email], [PropertyRole],
[LinkNotes], [PrimaryPerson] FROM [vw_PeoplePropLi nk] WHERE [PropertyID] =
@QSPropID"

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

<DeleteParamete rs>

<asp:Paramete r Name="PropLinkI D" Type="Int32" />

</DeleteParameter s>

<UpdateParamete rs>

<asp:Paramete r Name="PersonID" Type="Int32" />

<asp:Paramete r Name="RoleID" Type="Int32" />

<asp:Paramete r Name="RoleName" Type="String" />

<asp:Paramete r Name="PropLinkI D" Type="Int32" />

<asp:Paramete r Name="Phone" Type="String" />

<asp:Paramete r Name="CellPhone " Type="String" />

<asp:Paramete r Name="Email" Type="String" />

<asp:Paramete r Name="LinkNotes " Type="String" />

<asp:Paramete r Name="PrimaryPe rson" Type="Boolean" />

</UpdateParameter s>

<InsertParamete rs>

<asp:Paramete r Name="PersonID" Type="Int32" />

<asp:Paramete r Name="RoleID" Type="Int32" />

<asp:Paramete r Name="RoleName" Type="String" />

</InsertParameter s>

<SelectParamete rs>

<asp:QueryStrin gParameter Name="QSPropID" QueryStringFiel d="p" Type="Int32"
/>

</SelectParameter s>

</asp:SqlDataSour ce>
Aug 24 '07 #1
1 7089
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
"David C" <dl*****@lifeti meinc.comwrote in message
news:eJ******** ******@TK2MSFTN GP06.phx.gbl...
>I have aspx web page with a GridView that displays data from a
SqlDataSourc e 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:SqlDataSou rce ID="SqlvwPeople PropLink" runat="server"

ConnectionStrin g="<%$ ConnectionStrin gs:RFPDataConne ctionString %>"

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

SelectCommand=" SELECT [PropLinkID], [PersonID], [RoleID], [RoleName],
[ContactName], [Phone], [CellPhone], [EmailLink], [email], [PropertyRole],
[LinkNotes], [PrimaryPerson] FROM [vw_PeoplePropLi nk] WHERE [PropertyID] =
@QSPropID"

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

<DeleteParamete rs>

<asp:Paramete r Name="PropLinkI D" Type="Int32" />

</DeleteParameter s>

<UpdateParamete rs>

<asp:Paramete r Name="PersonID" Type="Int32" />

<asp:Paramete r Name="RoleID" Type="Int32" />

<asp:Paramete r Name="RoleName" Type="String" />

<asp:Paramete r Name="PropLinkI D" Type="Int32" />

<asp:Paramete r Name="Phone" Type="String" />

<asp:Paramete r Name="CellPhone " Type="String" />

<asp:Paramete r Name="Email" Type="String" />

<asp:Paramete r Name="LinkNotes " Type="String" />

<asp:Paramete r Name="PrimaryPe rson" Type="Boolean" />

</UpdateParameter s>

<InsertParamete rs>

<asp:Paramete r Name="PersonID" Type="Int32" />

<asp:Paramete r Name="RoleID" Type="Int32" />

<asp:Paramete r Name="RoleName" Type="String" />

</InsertParameter s>

<SelectParamete rs>

<asp:QueryStrin gParameter Name="QSPropID" QueryStringFiel d="p"
Type="Int32" />

</SelectParameter s>

</asp:SqlDataSour ce>


Aug 24 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1219
by: Jason Shohet | last post by:
I'm using the new SqlDataSource with the beta. Below I have my code: asp:SqlDataSource ID="ds" Runat="server" SelectCommand="SELECT employee_ssno, firstname, lastname FROM employee_temp order by lastname" ConnectionString="<%$ ConnectionStrings:AppConnectionString1 %>" ProviderName="System.Data.OleDb" UpdateCommand="UPDATE DBOWEB.EMPLOYEE_TEMP SET firstname=?, lastname=? WHERE employee_ssno=?"> </asp:SqlDataSource>
1
18891
by: fuchs.markus | last post by:
Hello, on my page, I have a DetailsViewControl connected to a SqlDataSource. Now when I dynamically set the FilterExpression and FilterParameters - for example in a OnClick-EventHandler of a button - the DetailsView shows the filtered Data, but Deleting and Updating doesn't work anymore. The DetailsView changes to EditMode, but after clicking on the UpdateButton it shows the old data. Am I missing something or is it just not possible or...
8
5043
by: Mike Kelly | last post by:
I've chosen to implement the "optimistic concurrency" model in my application. To assist in that, I've added a ROWVERSION (TIMESTAMP) column to my main tables. I read the value of the column in my select, remember it, and then use it in the update. It works just fine when I have full control of the whole process. I want to do the same for my GridView/SqlDataSource combinations. I typically select from a view and update the corresponding...
0
1512
by: Will | last post by:
I have searched and solutions that I have found are not working, I have a datagrid that will be updating a mysql db. Now I have a drop down that has a static collection but is dynamically selected to a selected value thats in the database. I click the edit button in the gridview and the drop down shows up fine, I pick a number in the drop down and hit update it says at that new number but the database never updates.....help anyone know...
0
2086
by: Lenny | last post by:
Hi. I've a problem with an update from the sqldatasource the table cannot be modified because it is from a third party sw table fields are: codice, fcli_inizio, fcli_fine. keys are codice and fcli_inizio when I run the update the field fcli_fine (not key) is updated but not the fcli_inizio. this is the code. db is in oracle.
3
1597
by: renatois | last post by:
SqlDataSource UpdateCommand plus Insert I have a SqlDataSource with an UpdateCommand but besides that i need also an Insert command triggered on the same update command. That´s because i need to update a record and at the same time include a log of that update in another database. Thanks
4
9791
by: mohaaron | last post by:
This seems like it should be simple to do but for some reason I have been unable to make it work. I would like to databind a SqlDataSource to a GridView during the click event of a button. This sounds easy but the next requirement is that the GridView is editable. So I have included the SelectCommand and the UpdateCommand on the SqlDataSource to allow the GridView to be editable. I have now been able to get the GridView to display data...
1
1400
by: ken | last post by:
Hi All, I try to using the dotnet control instead of code behind to create a quick solution (ASP.NET with VB.NET) by using the SqlDataSource and GridView control (with SelectCommand, DeleteCommand, UpdateCommand, InsertCommand) It works fine when drag and drop in the first time. but after I have modify something (said, add parmeters for searching...etc), the UpdateCommand and
0
1747
by: =?Utf-8?B?UEs5?= | last post by:
I have a very simple setup that should work fine per documentation. However, my gridview control will not properly update using the updatecommand of the sqldatasource. I've simplified everything below. I'd like to be able to see a table of results in my gridview, click edit on any particular record, modify the data, then click update. What I find is happening is that my parameters are not being updated when I go into edit mode, change the...
0
9530
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10236
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10182
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10017
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7552
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5445
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5577
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4120
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2928
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.