Formview not updating data correctly

C

Cirene

I have a formview that is calling a stored procedure (thru an sqldatasource)
to update 2 tables. When I execute the update it runs fine, with no errors.
But the data does NOT change. Any ideas why?

Here's the stored proc, the datasource and the edit template of the
formview...

***************STORED PROC*******************
ALTER PROCEDURE dbo.UpdateCompanyUsers
(
@UserId uniqueidentifier,
@CompanyUserId int,
@CompanyId int,
@FirstName nvarchar(MAX),
@LastName nvarchar(MAX),
@Phone nvarchar(MAX),
@Phone2 nvarchar(MAX),
@Fax nvarchar(MAX),
@Email nvarchar(MAX)
)
AS

BEGIN
UPDATE CompanyUsers
SET
CompanyId=@CompanyId,
FirstName=@FirstName,
LastName=@LastName,
Phone=@Phone,
Phone2=@Phone2,
Fax=@Fax
WHERE (CompanyUserId = @CompanyUserId)

UPDATE dbo.aspnet_Membership WITH (ROWLOCK)
SET
Email = @Email,
LoweredEmail = LOWER(@Email)
WHERE
@UserId = UserId

RETURN
END

****************SQL DATA SOURCE********************
<asp:SqlDataSource ID="sdsUser" runat="server"
ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
:
UpdateCommand="UpdateCompanyUsers"
UpdateCommandType="StoredProcedure">
:
<UpdateParameters>
<asp:parameter Name="UserId" />
<asp:parameter Name="CompanyUserId" Type="Int32" />
<asp:parameter Name="CompanyId" Type="Int32" />
<asp:parameter Name="FirstName" Type="String" />
<asp:parameter Name="LastName" Type="String" />
<asp:parameter Name="Phone" Type="String" />
<asp:parameter Name="Phone2" Type="String" />
<asp:parameter Name="Fax" Type="String" />
<asp:parameter Name="Email" Type="String" />
</UpdateParameters>
</asp:SqlDataSource>

*******************FORM VIEW EDIT TEMPLATE**********************
<EditItemTemplate>
<table class="style1">
<tr>
<td class="style2">
Company:</td>
<td>
<telerik:RadComboBox ID="RadComboBox1"
Runat="server"
DataSourceID="sdsCompanies"
DataTextField="CompanyName"
DataValueField="CompanyId"
SelectedValue='<%# Bind("CompanyId") %>'>
<CollapseAnimation Duration="200"
Type="OutQuint" />
</telerik:RadComboBox>
</td>
</tr>
<tr>
<td class="style2">
First Name:</td>
<td>
<asp:TextBox ID="FirstNameTextBox"
runat="server"
Text='<%# Bind("FirstName") %>' />
</td>
</tr>
<tr>
<td class="style2">
Last Name:</td>
<td>
<asp:TextBox ID="LastNameTextBox"
runat="server"
Text='<%# Bind("LastName") %>' />
</td>
</tr>
<tr>
<td class="style2">
Phone:</td>
<td>
<asp:TextBox ID="PhoneTextBox"
runat="server" Text='<%# Bind("Phone") %>' />
</td>
</tr>
<tr>
<td class="style2">
Phone2:</td>
<td>
<asp:TextBox ID="Phone2TextBox"
runat="server" Text='<%# Bind("Phone2") %>' />
</td>
</tr>
<tr>
<td class="style2">
Fax:</td>
<td>
<asp:TextBox ID="FaxTextBox" runat="server"
Text='<%# Bind("Fax") %>' />
</td>
</tr>
<tr>
<td class="style2">
Email:</td>
<td>
<asp:TextBox ID="EmailTextBox"
runat="server" Text='<%# Bind("Email") %>' />
</td>
</tr>
<tr>
<td class="style2">
<asp:Label ID="CompanyUserIdLabel1"
runat="server"
Text='<%# Eval("CompanyUserId") %>'
Visible="False" />
</td>
<td>
<asp:Label ID="Label1" runat="server"
Text='<%# Eval("UserId") %>'
Visible="False"></asp:Label>
</td>
</tr>
</table>
&nbsp;<asp:LinkButton ID="UpdateButton" runat="server"
CausesValidation="True"
CommandName="Update" Text="Update" />
&nbsp;<asp:LinkButton ID="UpdateCancelButton"
runat="server"
CausesValidation="False" CommandName="Cancel"
Text="Cancel" />
</EditItemTemplate>
 

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,829
Messages
2,569,737
Members
45,525
Latest member
RosalindSa

Latest Threads

Top