Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Formview not updating data correctly

Reply
Thread Tools

Formview not updating data correctly

 
 
Cirene
Guest
Posts: n/a
 
      05-23-2008
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>
<asparameter Name="UserId" />
<asparameter Name="CompanyUserId" Type="Int32" />
<asparameter Name="CompanyId" Type="Int32" />
<asparameter Name="FirstName" Type="String" />
<asparameter Name="LastName" Type="String" />
<asparameter Name="Phone" Type="String" />
<asparameter Name="Phone2" Type="String" />
<asparameter Name="Fax" Type="String" />
<asparameter 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>


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
FormView control wiping data/not updating John Mason ASP .Net 0 07-22-2008 07:14 AM
Updating JTable Atomically - block data changes while updating. news.rcn.com Java 2 12-10-2007 11:49 AM
LastActivityDate in aspnet_Users Not Updating Correctly Dan Sikorsky ASP .Net 1 01-02-2007 01:46 AM
FormView/Repeater/ Eval(FormView data) David Thielen ASP .Net Web Controls 2 06-16-2006 07:56 PM
FormView not updating MasterChief ASP .Net 1 03-02-2006 01:38 PM



Advertisments