473,785 Members | 2,811 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Update Query in formview

Greetings all!

After a week of toiling I've finallay decided to post the code below with
hopes that someone can point out my error(s).

Basically I have a Gridview/Formview on a ASP.NEt 2.0 page.
When I select a record on the Gridview I'm presented with the corresponding
FormView Template for Editing. Works fine!

ItemTemplate in FormView works fine...Edit button takes me Edit Template!

However...

Upon clicking the Update button on the item Tempalte (With the associated
SqlDataSource associated below my data fails to update.)

I'm sure my error is obvious but I just cannot find it.
<asp:SqlDataSou rce ID="REACTOR_AHT s" runat="server"
ConnectionStrin g="<%$
ConnectionStrin gs:REACTORConne ctionString % %>"
ProviderName="< %$
ConnectionStrin gs:REACTORConne ctionString.Pro viderName %>"
OldValuesParame terFormatString ="original_{ 0}"
SelectCommand=
"SELECT CaseCounter,
Condition_of_An imal,
TreatmentCardHi story
FROM Animal_Health_R ecords
WHERE (CaseCounter = @CaseCounter)"

UpdateCommand=
"UPDATE Animal_Health_R ecords
SET Condition_of_An imal = @Condition_of_A nimal,
TreatmentCardHi story = @TreatmentCardH istory
WHERE (Animal_Health_ Records.CaseCou nter =
@original_CaseC ounter)">

<DeleteParamete rs>
</DeleteParameter s>
<UpdateParamete rs>
<asp:Paramete r Name="Condition _of_Animal" Type="String" />
<asp:Paramete r Name="Treatment CardHistory" Type="String"
/>
<asp:ControlPar ameter ControlID="grdR EACTOR"
Name="original_ CaseCounter" PropertyName="S electedValue" Type="Int32" />
</UpdateParameter s>

<SelectParamete rs>
<asp:ControlPar ameter ControlID="grdR EACTOR"
Name="CaseCount er" PropertyName="S electedValue"
Type="Int32" />
</SelectParameter s>
</asp:SqlDataSour ce>
--

All suggestions welcomed!
Application Engineer / DBA
UCLA SOM
Apr 13 '06 #1
3 3087
Hi Marcial,
What error message are you getting when you try to update?
Chris

Apr 14 '06 #2
No visible errors.. the updates just fails to be posted. the formview simply
reverts to the ItemTemplate and datsa remains unchanged!
--
Application Engineer / DBA
UCLA SOM
"Chris Fulstow" wrote:
Hi Marcial,
What error message are you getting when you try to update?
Chris

Apr 14 '06 #3
Hi Marcial, try this & let me know if it still doesn't work

UpdateCommand=
"UPDATE [Animal_Health_R ecords] SET [Condition_of_An imal] = ?,
[TreatmentCardHi story] = ? WHERE
[Animal_Health_R ecords.CaseCoun ter] =?

<UpdateParamete rs>
<asp:Paramete r Name="Condition _of_Animal" Type="String" />
<asp:Paramete r Name="Treatment CardHistory" Type="String "/>
<asp:Paramete r
Name="Animal_He alth_Records.Ca seCounter"Type= "String"/>
</UpdateParameter s>

n.b: check again the Animal_Health_R ecords.CaseCoun ter data type

Apr 14 '06 #4

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

Similar topics

3
3879
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...
4
3424
by: Jim Hammond | last post by:
It would be udeful to be able to get the current on-screen values from a FormView that is databound to an ObjectDataSource by using a callback instead of a postback. For example: public void RaiseCallbackEvent(string eventArgs) { // update the data object with the values currently on screen FormView1.UpdateItem(true); }
0
2208
by: Metal2You | last post by:
I'm working on an ASP.NET 2.0 application in Visual Studio 2005 that accesses a Sybase database back end. We're using Sybase SQL Anywhere 9.0.2.3228. I have installed and registered the Sybase .NET 2.0 DataProvider (iAnywhere.Data.AsaClient.dll) into the GAC so it can be used in the ProviderName property of a SQLDataSource and loads properly at run time. The application I'm writing is a bit more complex than the example I'm about to...
0
2494
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" %>
0
1231
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 can not be prior to 1/1/2006") business layer rejects the data and Update method returns False (or...
3
3642
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='<%#
3
4806
by: Brad Baker | last post by:
I have a formview with a datasource that contains a select and update command. The select statement works fine but the update command doesn't seem to be working. After some troubleshooting I have narrowed the problem down to the department_id parameter which is set from a hidden field. I can confirm this by hard coding the UpdateCommand to: UPDATE configuration SET special_notes=@special_notes WHERE (student_id=@student_id) AND...
2
2641
by: Aamir Ghanchi | last post by:
Hi, Why does the Update method of an ObjectDataSource class requires parameters for each of the Bind input controls of a FormView? I have a class (say MyObjectDataSource) that is being used as an ObjectDataSource for a FormView control. MyObjectDataSource has public properties that correspond to db table columns and are also used to < %# Bind("")%Input controls in the formview declaratively. There is an Update method in...
5
7038
by: somacore | last post by:
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=
0
9480
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 synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
10093
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,...
0
9952
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 choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7500
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5381
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...
0
5511
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4053
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
2
3654
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2880
bsmnconsultancy
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...

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.