473,383 Members | 1,716 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 software developers and data experts.

Formview not updating data correctly

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>
Jun 27 '08 #1
0 1413

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

Similar topics

3
by: Michael Glass | last post by:
I'm working on an ASP.Net web app using VS2005 and the .Net 2.0 framework, and I have a serious problem with the page I'm currently working on. The page has, among other things, two FormViews and a...
2
by: P. Yanzick | last post by:
Hello, I am creating an edit template for a FormView control, changing one of the textboxes to a dropdown box. The dropdown will be populated from a simple table with the primary key, and a...
0
by: sanjeev06 | last post by:
When Updating using a FormView and ObjectDataSource, the formview always does the data-binding of its controls and the field values in the FormView are always overwritten by the results of the...
1
by: Dave E | last post by:
Hi all, == brief version == using ASP 2.0, I have a ddl inside a formview. On update, if the ddl starts as NULL, no update happens. If the ddl has a bound value that is not NULL, then all...
0
by: hardieca | last post by:
Hi, My formview or gridview control stops updating or deleting a record once the record has a null value. I have table tblTest with the following pkID int NOT NULL **IDENTITY COLUMN**...
3
by: J055 | last post by:
Hi I have a PlaceHolder control inside a FormView EditItemTemplate: <asp:PlaceHolder ID="phResponseText" runat="server"> <tr> <td> <asp:Label ID="lblResponseText"...
2
by: J055 | last post by:
Hi I need some help with this one. If I add this LinkButton Command event I get an 'System.Web.HttpException: Failed to load viewstate' on the second postback. It only occurs when...
0
by: m.bagattini | last post by:
Hello folks, I'll try to be as much clear as I can. This is my issue: Asp.NET 2.0 page w/ FormView (later: FW), an ObjectDataSource (ODS). It works with my Business logic layer, where I have...
3
by: KaOne | last post by:
Hi All, excuse me in advance for my not very perfect english. I need some help about a problem with a FormView bounded to an ObjectDataSource. In practise I have an ObjectDataSource that uses some...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

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.