I have a C# webform which uses a formview to insert, update, and delete records selected from a gridview into an Access database. The insert and delete functions work fine, the update does not. - The formview has 'id' as a DataKeyName.
- The update works if done from the Query Builder and I enter the values manually
- I don't have anything in the codebehind for the update event.
UpdateCommand: - UpdateCommand=
-
"UPDATE CM_Codebase
-
SET
-
build_label = ?
-
, program_type = ?
-
, program_name = ?
-
, ticket_status = ?
-
, push_number = ?
-
, approved = ?
-
, comments = ?
-
WHERE
-
(id = ?)"
UpdateParameter s: - <UpdateParameters>
-
<asp:Parameter Name="build_label" />
-
<asp:Parameter Name="program_type" />
-
<asp:Parameter Name="program_name" />
-
<asp:Parameter Name="ticket_status" />
-
<asp:Parameter Name="push_number" />
-
<asp:Parameter Name="approved" />
-
<asp:Parameter Name="comments" />
-
<asp:Parameter Name="id" />
-
</UpdateParameters>
FormView Definition: -
<asp:FormView ID="FormView1"
-
runat="server" BackColor="LightGoldenrodYellow"
-
BorderColor="Tan" BorderWidth="1px"
-
CellPadding="2" DataKeyNames="id"
-
DataMember="DefaultView" DataSourceID="AccessDataSource1"
-
ForeColor="Black" HorizontalAlign="Center">
-
<FooterStyle BackColor="Tan" />
-
Update Button: -
<asp:LinkButton ID="UpdateButton"
-
runat="server" CausesValidation="True"
-
CommandName="Update"
-
Text="Update">
-
Any help is appreciated.
5 7038 Plater 7,872
Recognized Expert Expert
What error message are you getting?
If you are not getting an error at all, it usually means that it found no record to update.
I'm not getting an error. The command proceeds as normal, like it's actually updating, then the page does the postback and everything is the same.
I've added some code to debug it... - protected void FormView1_ItemUpdating(object sender, FormViewUpdateEventArgs e)
-
{
-
object comments = e.OldValues["comments"];
-
object newcomment = e.NewValues["comments"];
-
}
Now, looking at the Autos debug window I see that it's getting the new value for the "comments" field, I changed the value to "BYZANTINE" just so it would stick out. The old value was "WHAT"
So, when I update the field and click the Update link button, it's getting the new value but for some reason not storing it.
What to do...
edit: Also, it's getting the key "id" just fine with its value of "10" so I'm not sure what to check next...
Edit again: Is there any way to see the SQL statement it's trying to use? If I just write out the update command it's giving me all the "?"'s but what I want to see are my variables in there.
Plater 7,872
Recognized Expert Expert
Hmm, I don't normally do data processing in the design section.
Nothing happens in your page load that populates or clears these values right?
You don't need to do any checking for isPostBack ?
I'm having exactly the same problem as Somacore.
Did you find a solution ?
I removed ConflictDetecti on="CompareAllV alues" in my SQLdatasource and now it works fine !
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Ottar |
last post by:
I have a few numeric fields, and when I update i get the error: "Input string
was not in a correct format". Next line:" System.Number.StringToNumber(String
str, NumberStyles options, NumberBuffer& number, NumberFormatInfo info,
Boolean parseDecimal) +2178925"
This is beacuse some of my TextBoxes are empty (no value). If I enter a
value it is OK.
I need to use Null values to indicate that the field is not fileld in.
|
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. FormView2 talks to my Activities table
and has an ItemTemplate, InsertItemTemplate and an...
|
by: sck10 |
last post by:
Hello,
I am creating a form for users to enter information about a lab and the
members of the lab. I have one form (FormView) that they use to enter
information about that lab. The keyvalue is "LabLocation_ID". With an
existing lab, they then need to add the members for that lab. So, what I am
trying to do is the following. With the FormView of the Lab open, the user
will click a button to open a FormView (InsertMode) and add a new...
|
by: sdash |
last post by:
I'm working on a simple formview screen that should update a SQL Server 2000
record. I'm sure there must be something simple wrong, but when I press
update, the screen refreshes and the changes are not committed to the table.
Can anyone give me some suggestions here?
Thanks in advance (code below)
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="EditItem.aspx.cs"
Inherits="EditItem" %>
|
by: Jurgen Appelo |
last post by:
I asked this question earlier, but unfortunately the two replies I got did
not solve the problem. Here it is again, but now with the code:
After an Update my FormView always loses its viewstate values. The field
values in the FormView are always overwritten by the results of the Update
method in the business layer. No matter what I do, the databind always takes
place, even when I don't want it to.
See the example below. This is a...
| |
by: Dabbler |
last post by:
I have a FormView with lots of field that have validators attached but none
of them are working. Most are RequiredFieldValidtors, some are Regex etc.
here's some of my code:
<asp:FormView ID="fvRegDetail" runat="server" DefaultMode="Edit"
DataKeyNames="RegistrantId" DataSourceID="odsRegistrant"
CssClass="waFormView" >
......
<EditItemTemplate>
<asp:TextBox ID="tbWArrival" Text='<%# Bind("WArrival")
|
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='<%#
|
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 receive 0 like return value from that
queries I understand that a concurrency problem is occurs so...
|
by: pankajsingh5k |
last post by:
Hi guys,
These question is for all the experts...
Please help me before my brain explodes
The problem is again with the formview control..
I have a formview and i have to use it that when it displays it shows values from the database and i have a link button edit on the ItemTemplate that changes the mode to edit mode and allows to edit the values which can be edited...
|
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 usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
| |
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 most users, this new feature is actually very convenient. If you want to control the update process,...
|
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 choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
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 launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
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
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |