473,569 Members | 2,751 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.UpdateCompa nyUsers
(
@UserId uniqueidentifie r,
@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=@Comp anyId,
FirstName=@Firs tName,
LastName=@LastN ame,
Phone=@Phone,
Phone2=@Phone2,
Fax=@Fax
WHERE (CompanyUserId = @CompanyUserId)

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

RETURN
END

*************** *SQL DATA SOURCE********* ***********
<asp:SqlDataSou rce ID="sdsUser" runat="server"
ConnectionStrin g="<%$ ConnectionStrin gs:ConnectionSt ring %>"
:
UpdateCommand=" UpdateCompanyUs ers"
UpdateCommandTy pe="StoredProce dure">
:
<UpdateParamete rs>
<asp:Paramete r Name="UserId" />
<asp:Paramete r Name="CompanyUs erId" Type="Int32" />
<asp:Paramete r Name="CompanyId " Type="Int32" />
<asp:Paramete r Name="FirstName " Type="String" />
<asp:Paramete r Name="LastName" Type="String" />
<asp:Paramete r Name="Phone" Type="String" />
<asp:Paramete r Name="Phone2" Type="String" />
<asp:Paramete r Name="Fax" Type="String" />
<asp:Paramete r Name="Email" Type="String" />
</UpdateParameter s>
</asp:SqlDataSour ce>

*************** ****FORM VIEW EDIT TEMPLATE******* ***************
<EditItemTempla te>
<table class="style1">
<tr>
<td class="style2">
Company:</td>
<td>
<telerik:RadCom boBox ID="RadComboBox 1"
Runat="server"
DataSourceID="s dsCompanies"
DataTextField=" CompanyName"
DataValueField= "CompanyId"
SelectedValue=' <%# Bind("CompanyId ") %>'>
<CollapseAnimat ion Duration="200"
Type="OutQuint" />
</telerik:RadComb oBox>
</td>
</tr>
<tr>
<td class="style2">
First Name:</td>
<td>
<asp:TextBox ID="FirstNameTe xtBox"
runat="server"
Text='<%# Bind("FirstName ") %>' />
</td>
</tr>
<tr>
<td class="style2">
Last Name:</td>
<td>
<asp:TextBox ID="LastNameTex tBox"
runat="server"
Text='<%# Bind("LastName" ) %>' />
</td>
</tr>
<tr>
<td class="style2">
Phone:</td>
<td>
<asp:TextBox ID="PhoneTextBo x"
runat="server" Text='<%# Bind("Phone") %>' />
</td>
</tr>
<tr>
<td class="style2">
Phone2:</td>
<td>
<asp:TextBox ID="Phone2TextB ox"
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="EmailTextBo x"
runat="server" Text='<%# Bind("Email") %>' />
</td>
</tr>
<tr>
<td class="style2">
<asp:Label ID="CompanyUser IdLabel1"
runat="server"
Text='<%# Eval("CompanyUs erId") %>'
Visible="False" />
</td>
<td>
<asp:Label ID="Label1" runat="server"
Text='<%# Eval("UserId") %>'
Visible="False" ></asp:Label>
</td>
</tr>
</table>
&nbsp;<asp:Link Button ID="UpdateButto n" runat="server"
CausesValidatio n="True"
CommandName="Up date" Text="Update" />
&nbsp;<asp:Link Button ID="UpdateCance lButton"
runat="server"
CausesValidatio n="False" CommandName="Ca ncel"
Text="Cancel" />
</EditItemTemplat e>
Jun 27 '08 #1
0 1430

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

Similar topics

3
3866
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 GridView control, each with its own SqlDataSource. FormView1 talks to my Opportunity table and has an ItemTemplate and an EditItemTemplate....
2
8734
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 description (i.e. a colors table, so there is a colors ID and a color description). The data source the FormView is pulling data from stores (in this...
0
1222
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 Update method. This behavior is fine when update method succeeds. But the problem is that when for some reason (e.g. a business rule "start date...
1
1430
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 updates happen as expected. How do I resolve this pleeeaase??!! :-)
0
1871
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** string1 varchar(30) string2 varchar(30)
3
3627
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" runat="server"></asp:Label></td> <td> <asp:TextBox ID="tbResponseText" runat="server" Text='<%#
2
5292
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 FormView1.UpdateItem(true) is called. The page posts back OK. When I do a second PostBack I get the error. protected void LinkButtonPrevNext_Command(object...
0
1316
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 some methods to retrieve and set data. ODS works with this MyObjectManager object. MyObjectManager has GetObjects that return an ObjectsCollection and...
3
8089
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 BLL methods that implements the optimistic concurrency by a TimeStamp field into the DB. So, when I execute an insert, update or delete query if I...
0
7694
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7609
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...
0
7921
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
1
7666
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...
0
7964
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...
0
6278
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
3636
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2107
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
1
1208
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.