473,386 Members | 1,795 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,386 software developers and data experts.

FormView not updating

I have a FormView that won't update at all. I have looked at thing such
as datakeys and making sure the update command is correct but I can't
find the problem. Here is my code. Could the item_id (the primary key)
being evaluated instead of binded have do with it?

<asp:FormView ID="FormView1" runat="server" DataKeyNames="item_id"
DataSourceID="SqlDataSourceEditWork"
DefaultMode="Edit" Height="340px" Width="757px">
<EditItemTemplate>
item_id:
<asp:Label ID="item_idLabel1" runat="server" Text='<%#
Eval("item_id") %>'></asp:Label><br />
item_date:
<asp:TextBox ID="item_dateTextBox" runat="server" Text='<%#
Bind("item_date") %>'></asp:TextBox><br />
item_orderID:
<asp:TextBox ID="item_orderIDTextBox" runat="server"
Text='<%# Bind("item_orderID") %>'></asp:TextBox><br />
item_brdft:
<asp:TextBox ID="item_brdftTextBox" runat="server"
Text='<%# Bind("item_brdft") %>'></asp:TextBox><br />
item_dollars:
<asp:TextBox ID="item_dollarsTextBox" runat="server"
Text='<%# Bind("item_dollars") %>'></asp:TextBox><br />
<asp:LinkButton ID="UpdateButton" runat="server"
CausesValidation="True" CommandName="Update"
Text="Update"></asp:LinkButton>
<asp:LinkButton ID="UpdateCancelButton" runat="server"
CausesValidation="False" CommandName="Cancel"
Text="Cancel"></asp:LinkButton>
</EditItemTemplate>
<ItemTemplate>
item_id:
<asp:Label ID="item_idLabel" runat="server" Text='<%#
Eval("item_id") %>'></asp:Label><br />
item_date:
<asp:Label ID="item_dateLabel" runat="server" Text='<%#
Bind("item_date") %>'></asp:Label><br />
item_orderID:
<asp:Label ID="item_orderIDLabel" runat="server" Text='<%#
Bind("item_orderID") %>'></asp:Label><br />
item_brdft:
<asp:Label ID="item_brdftLabel" runat="server" Text='<%#
Bind("item_brdft") %>'></asp:Label><br />
item_dollars:
<asp:Label ID="item_dollarsLabel" runat="server" Text='<%#
Bind("item_dollars") %>'></asp:Label><br />
<asp:LinkButton ID="EditButton" runat="server"
CausesValidation="False" CommandName="Edit"
Text="Edit"></asp:LinkButton>
<asp:LinkButton ID="DeleteButton" runat="server"
CausesValidation="False" CommandName="Delete"
Text="Delete"></asp:LinkButton>
<asp:LinkButton ID="NewButton" runat="server"
CausesValidation="False" CommandName="New"
Text="New"></asp:LinkButton>
</ItemTemplate>
<InsertItemTemplate>
item_date:
<asp:TextBox ID="item_dateTextBox" runat="server" Text='<%#
Bind("item_date") %>'>
</asp:TextBox><br />
item_orderID:
<asp:TextBox ID="item_orderIDTextBox" runat="server"
Text='<%# Bind("item_orderID") %>'>
</asp:TextBox><br />
item_brdft:
<asp:TextBox ID="item_brdftTextBox" runat="server"
Text='<%# Bind("item_brdft") %>'>
</asp:TextBox><br />
item_dollars:
<asp:TextBox ID="item_dollarsTextBox" runat="server"
Text='<%# Bind("item_dollars") %>'>
</asp:TextBox><br />
<asp:LinkButton ID="InsertButton" runat="server"
CausesValidation="True" CommandName="Insert"
Text="Insert">
</asp:LinkButton>
<asp:LinkButton ID="InsertCancelButton" runat="server"
CausesValidation="False" CommandName="Cancel"
Text="Cancel">
</asp:LinkButton>
</InsertItemTemplate>
</asp:FormView>
<asp:SqlDataSource ID="SqlDataSourceTechnician" runat="server"
ConnectionString="<%$ ConnectionStrings:purchasedWoodConnectionString
%>"
SelectCommand="SELECT [UserName], [UserId] FROM
[vw_aspnet_Users]"></asp:SqlDataSource>
<asp:SqlDataSource ID="SqlDataSourceEditWork" runat="server"
ConnectionString="<%$ ConnectionStrings:purchasedWoodConnectionString
%>" DeleteCommand="DELETE FROM [items] WHERE [item_id] =
@original_item_id AND [item_date] = @original_item_date AND
[item_orderID] = @original_item_orderID AND [item_brdft] =
@original_item_brdft AND [item_dollars] = @original_item_dollars"
InsertCommand="INSERT INTO [items] ([item_date], [item_orderID],
[item_brdft], [item_dollars]) VALUES (@item_date, @item_orderID,
@item_brdft, @item_dollars)" SelectCommand="SELECT * FROM [items] WHERE
([item_id] = @item_id)" UpdateCommand="UPDATE [items] SET [item_date] =
@item_date, [item_orderID] = @item_orderID, [item_brdft] = @item_brdft,
[item_dollars] = @item_dollars WHERE [item_id] = @original_item_id AND
[item_date] = @original_item_date AND [item_orderID] =
@original_item_orderID AND [item_brdft] = @original_item_brdft AND
[item_dollars] = @original_item_dollars"
ConflictDetection="CompareAllValues"
OldValuesParameterFormatString="original_{0}">
<DeleteParameters>
<asp:Parameter Name="original_item_id" Type="Int32" />
<asp:Parameter Name="original_item_date" Type="DateTime" />
<asp:Parameter Name="original_item_orderID" Type="String"
/>
<asp:Parameter Name="original_item_brdft" Type="Decimal" />
<asp:Parameter Name="original_item_dollars" Type="Decimal"
/>
</DeleteParameters>
<UpdateParameters>
<asp:Parameter Name="item_date" Type="DateTime" />
<asp:Parameter Name="item_orderID" Type="String" />
<asp:Parameter Name="item_brdft" Type="Decimal" />
<asp:Parameter Name="item_dollars" Type="Decimal" />
<asp:Parameter Name="original_item_id" Type="Int32" />
<asp:Parameter Name="original_item_date" Type="DateTime" />
<asp:Parameter Name="original_item_orderID" Type="String"
/>
<asp:Parameter Name="original_item_brdft" Type="Decimal" />
<asp:Parameter Name="original_item_dollars" Type="Decimal"
/>
</UpdateParameters>
<SelectParameters>
<asp:QueryStringParameter Name="item_id"
QueryStringField="item_id" Type="Int32" />
</SelectParameters>
<InsertParameters>
<asp:Parameter Name="item_date" Type="DateTime" />
<asp:Parameter Name="item_orderID" Type="String" />
<asp:Parameter Name="item_brdft" Type="Decimal" />
<asp:Parameter Name="item_dollars" Type="Decimal" />
</InsertParameters>
</asp:SqlDataSource>
</asp:Content>

Feb 23 '06 #1
1 2827
Only use the item_id in your WHERE clause for the UpdateCommand.
--
Christopher A. Reed
"The oxen are slow, but the earth is patient."

"MasterChief" <co*******@mix-net.net> wrote in message
news:11**********************@p10g2000cwp.googlegr oups.com...
I have a FormView that won't update at all. I have looked at thing such
as datakeys and making sure the update command is correct but I can't
find the problem. Here is my code. Could the item_id (the primary key)
being evaluated instead of binded have do with it?

<asp:FormView ID="FormView1" runat="server" DataKeyNames="item_id"
DataSourceID="SqlDataSourceEditWork"
DefaultMode="Edit" Height="340px" Width="757px">
<EditItemTemplate>
item_id:
<asp:Label ID="item_idLabel1" runat="server" Text='<%#
Eval("item_id") %>'></asp:Label><br />
item_date:
<asp:TextBox ID="item_dateTextBox" runat="server" Text='<%#
Bind("item_date") %>'></asp:TextBox><br />
item_orderID:
<asp:TextBox ID="item_orderIDTextBox" runat="server"
Text='<%# Bind("item_orderID") %>'></asp:TextBox><br />
item_brdft:
<asp:TextBox ID="item_brdftTextBox" runat="server"
Text='<%# Bind("item_brdft") %>'></asp:TextBox><br />
item_dollars:
<asp:TextBox ID="item_dollarsTextBox" runat="server"
Text='<%# Bind("item_dollars") %>'></asp:TextBox><br />
<asp:LinkButton ID="UpdateButton" runat="server"
CausesValidation="True" CommandName="Update"
Text="Update"></asp:LinkButton>
<asp:LinkButton ID="UpdateCancelButton" runat="server"
CausesValidation="False" CommandName="Cancel"
Text="Cancel"></asp:LinkButton>
</EditItemTemplate>
<ItemTemplate>
item_id:
<asp:Label ID="item_idLabel" runat="server" Text='<%#
Eval("item_id") %>'></asp:Label><br />
item_date:
<asp:Label ID="item_dateLabel" runat="server" Text='<%#
Bind("item_date") %>'></asp:Label><br />
item_orderID:
<asp:Label ID="item_orderIDLabel" runat="server" Text='<%#
Bind("item_orderID") %>'></asp:Label><br />
item_brdft:
<asp:Label ID="item_brdftLabel" runat="server" Text='<%#
Bind("item_brdft") %>'></asp:Label><br />
item_dollars:
<asp:Label ID="item_dollarsLabel" runat="server" Text='<%#
Bind("item_dollars") %>'></asp:Label><br />
<asp:LinkButton ID="EditButton" runat="server"
CausesValidation="False" CommandName="Edit"
Text="Edit"></asp:LinkButton>
<asp:LinkButton ID="DeleteButton" runat="server"
CausesValidation="False" CommandName="Delete"
Text="Delete"></asp:LinkButton>
<asp:LinkButton ID="NewButton" runat="server"
CausesValidation="False" CommandName="New"
Text="New"></asp:LinkButton>
</ItemTemplate>
<InsertItemTemplate>
item_date:
<asp:TextBox ID="item_dateTextBox" runat="server" Text='<%#
Bind("item_date") %>'>
</asp:TextBox><br />
item_orderID:
<asp:TextBox ID="item_orderIDTextBox" runat="server"
Text='<%# Bind("item_orderID") %>'>
</asp:TextBox><br />
item_brdft:
<asp:TextBox ID="item_brdftTextBox" runat="server"
Text='<%# Bind("item_brdft") %>'>
</asp:TextBox><br />
item_dollars:
<asp:TextBox ID="item_dollarsTextBox" runat="server"
Text='<%# Bind("item_dollars") %>'>
</asp:TextBox><br />
<asp:LinkButton ID="InsertButton" runat="server"
CausesValidation="True" CommandName="Insert"
Text="Insert">
</asp:LinkButton>
<asp:LinkButton ID="InsertCancelButton" runat="server"
CausesValidation="False" CommandName="Cancel"
Text="Cancel">
</asp:LinkButton>
</InsertItemTemplate>
</asp:FormView>
<asp:SqlDataSource ID="SqlDataSourceTechnician" runat="server"
ConnectionString="<%$ ConnectionStrings:purchasedWoodConnectionString
%>"
SelectCommand="SELECT [UserName], [UserId] FROM
[vw_aspnet_Users]"></asp:SqlDataSource>
<asp:SqlDataSource ID="SqlDataSourceEditWork" runat="server"
ConnectionString="<%$ ConnectionStrings:purchasedWoodConnectionString
%>" DeleteCommand="DELETE FROM [items] WHERE [item_id] =
@original_item_id AND [item_date] = @original_item_date AND
[item_orderID] = @original_item_orderID AND [item_brdft] =
@original_item_brdft AND [item_dollars] = @original_item_dollars"
InsertCommand="INSERT INTO [items] ([item_date], [item_orderID],
[item_brdft], [item_dollars]) VALUES (@item_date, @item_orderID,
@item_brdft, @item_dollars)" SelectCommand="SELECT * FROM [items] WHERE
([item_id] = @item_id)" UpdateCommand="UPDATE [items] SET [item_date] =
@item_date, [item_orderID] = @item_orderID, [item_brdft] = @item_brdft,
[item_dollars] = @item_dollars WHERE [item_id] = @original_item_id AND
[item_date] = @original_item_date AND [item_orderID] =
@original_item_orderID AND [item_brdft] = @original_item_brdft AND
[item_dollars] = @original_item_dollars"
ConflictDetection="CompareAllValues"
OldValuesParameterFormatString="original_{0}">
<DeleteParameters>
<asp:Parameter Name="original_item_id" Type="Int32" />
<asp:Parameter Name="original_item_date" Type="DateTime" />
<asp:Parameter Name="original_item_orderID" Type="String"
/>
<asp:Parameter Name="original_item_brdft" Type="Decimal" />
<asp:Parameter Name="original_item_dollars" Type="Decimal"
/>
</DeleteParameters>
<UpdateParameters>
<asp:Parameter Name="item_date" Type="DateTime" />
<asp:Parameter Name="item_orderID" Type="String" />
<asp:Parameter Name="item_brdft" Type="Decimal" />
<asp:Parameter Name="item_dollars" Type="Decimal" />
<asp:Parameter Name="original_item_id" Type="Int32" />
<asp:Parameter Name="original_item_date" Type="DateTime" />
<asp:Parameter Name="original_item_orderID" Type="String"
/>
<asp:Parameter Name="original_item_brdft" Type="Decimal" />
<asp:Parameter Name="original_item_dollars" Type="Decimal"
/>
</UpdateParameters>
<SelectParameters>
<asp:QueryStringParameter Name="item_id"
QueryStringField="item_id" Type="Int32" />
</SelectParameters>
<InsertParameters>
<asp:Parameter Name="item_date" Type="DateTime" />
<asp:Parameter Name="item_orderID" Type="String" />
<asp:Parameter Name="item_brdft" Type="Decimal" />
<asp:Parameter Name="item_dollars" Type="Decimal" />
</InsertParameters>
</asp:SqlDataSource>
</asp:Content>

Mar 2 '06 #2

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...
1
by: yuchang | last post by:
Hi, Using the FormView control is very efficient. But I want to do some action,like showing a success message or redirect to another page, after inserting, updating and deleting. How do I get...
1
by: Dabbler | last post by:
I have a FormView tied to ObjectDataSource that's not updating and am wondering what I missed.. <asp:FormView ID="fvRegDetail" runat="server" DefaultMode="Edit" DataKeyNames="RegistrantId"...
2
by: sck10 | last post by:
Hello, I have a SQL Server 2K table with a field set to currency. When I try to insert or update a FormView, I get the following error: Disallowed implicit conversion from data type nvarchar...
0
by: Jai | last post by:
Hi, Somebody please tell me how to bind(two way) a checkboxlist with objectdatasource if the checkboxlist is inside a formview..... Code of FormView is like this::--- <asp:FormView...
0
by: Jai | last post by:
Hi, Somebody please tell me how to bind(two way) a checkboxlist with objectdatasource if the checkboxlist is inside a formview..... Code of FormView is like this::--- <asp:FormView...
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"...
0
by: =?Utf-8?B?TGFkaXNsYXYgTXJua2E=?= | last post by:
Hello, I read some msdn and other articles about how does databinding among DataSource controls and FormView / GridView controls works but I still don't fully understand to this blackbox. I have...
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...
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...
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:
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
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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?
0
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,...
0
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...
0
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,...

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.