[x]
Posted via EE Mobile

Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again.

Question
[x]
Attachment Details

ASP- multiple update and only update fields that have a new value

Asked by chlaas in Active Server Pages (ASP), VB Script, SQL Server 2005

Tags: ASP - UPDATE - VBSCRIPT

Hi

I have the following problem. I have a table containing many records linked to a person. When this person (table a) looks at his page it is displayed questions that belongs to him (table b).

The goal of this page is to update the changes he makes to these records and insert the date he made the changes to these records.

Example:

Peter has these records attaches to him:

1. question - answer value 1 - no date
2. question - answer value 1 - no date
3. question - answer value 4 - 11-12-2009
4. question - answer value 3 - 09-12-2009
5. question - answer value 2 - 02-12-2009

Now, if Peter changes the answer value of question 2, 3 and 4 I want to update only question 2, 3 and 4 since these are the records where the value changes. This means that question 2,3 and 4 changes the answer value from a drop down menu and that these questions are updated with the date of today.

I have (in my newbie world ) landed on a solution I think might work. I have a multiple update function that works, but it updates all the records in the repeated region but does not update the date field in the recordset.

I thought it might be possible to have a hidden field with the value from the form element witch represents the answer field in the recordset. Then I have a hidden field with the "original" value of the answer field - then I could have an if condition that is based on if the original value is equal the form value sent then do not update and if the original value is not equal to the form value then update record and update with date.

Is this possible or is there an easier way?

I have tried to write an if sentence that does not work and it looks something like this:

<%
if (Request.Form("orig_value")) < > (Request.Form("new_value_count")) Then %>
<input type="hidden" id="new_alter_value" value="Request.Form("new_value_count")" />
<% End if %>
<%
if (Request.Form("orig_value")) = (Request.Form("new_value_count")) Then %>
<input type="hidden" id="donotsend" value="" />
<% End if %>

In the update part of my asp page I have chosen to update the recordset with the fields that have the id="new_alter_value" and update the date fields altso

I am quite desperate now and been working late night hours, so I am sorry for bad english and bad logic.

Any help will be great help.
Thanks in advance.

PS. I am using asp vbscript and a mssql 2005 database.
 
Related Solutions
Keywords: ASP- multiple update and only update …
 
Loading Advertisement...
 
[+][-]11/08/09 02:16 AM, ID: 25770017Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]11/08/09 02:22 AM, ID: 25770029Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]11/08/09 02:23 AM, ID: 25770033Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]11/08/09 06:37 AM, ID: 25770593Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]11/08/09 06:46 AM, ID: 25770624Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]11/08/09 10:47 AM, ID: 25771367Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20091021-EE-VQP-81 - Hierarchy / EE_QW_3_20080625