CodeCharge Studio
search Register Login  

Web Reports

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> ASP

 Execute Update doesn't error nor updates record

Print topic Send  topic

Author Message
dhodgdon

Posts: 80
Posted: 08/16/2004, 1:54 AM

I am trying to update a column in a record with a calculated value of a label in a grid. The Execute statement doesn't error out nor does it store the value in the table. If I substitute a constant for the value of the label the table is updated. Any ideas on what I am doing wrong?

grid name: Results
label name: Average
table: sessions
column to update: OverallQuality
key table column: SessionName (a unique text value)

dim dbconnection
set dbconnection = New clsDBccFAESurvey
dbconnection.open
dbconnection.Execute("UPDATE sessions SET OverallQuality = results.average.value WHERE SessionName=" & dbconnection.ToSQL("TTD",ccsText))
dbconnection.close

_________________
Regards,
David Hodgdon
View profile  Send private message
eiden


Posts: 34
Posted: 08/16/2004, 5:18 AM

You have most likely not used the quotes ( ' ' ) correctly.

Read the section "using quotes":

http://www.w3schools.com/sql/sql_where.asp
View profile  Send private message
dhodgdon

Posts: 80
Posted: 08/16/2004, 9:46 PM

I checked the info and it looks like the problem is with using a label value rather than a constant. Below are two lines of code, the one with a constant works, the one using a label value doesn't. Will SQL not let you use a label value in the expression? I couldn't find anything that prohibited this.

The following updates the column correctly with the constant integer 5:
dbconnection.Execute("UPDATE sessions SET OverallQuality = 5 WHERE SessionName=" & dbconnection.ToSQL("TTD",ccsText))

The following is intended to update the column with the value of the label Average in grid Results but does not change the column nor does it create an error:
dbconnection.Execute("UPDATE sessions SET OverallQuality = Results.Average.value WHERE SessionName=" & dbconnection.ToSQL("TTD",ccsText))
_________________
Regards,
David Hodgdon
View profile  Send private message
DonB
Posted: 08/19/2004, 9:30 PM

Labels are not "active" elements on the page - they exist only as character
strings. Thus, their values are not POSTed back to the server like other
controls (such as the Textbox).

Remember, when that Update executes, there has been a "round trip" and the
Update is working with data sent back from the <FORM> that was submitted.
By that time, the Label is just a fond memory because the page on which it
existed has been thrown away. You either need to marshal the value, to the
browser and back, in a hidden field or retrieve it from the underlying data
source.

--
DonB

http://www.gotodon.com/ccbth


"dhodgdon" <dhodgdon@forum.codecharge> wrote in message
news:641218d8a35e38@news.codecharge.com...
> I checked the info and it looks like the problem is with using a label
value
> rather than a constant. Below are two lines of code, the one with a
constant
> works, the one using a label value doesn't. Will SQL not let you use a
label
> value in the expression? I couldn't find anything that prohibited this.
>
> The following updates the column correctly with the constant integer 5:
> dbconnection.Execute("UPDATE sessions SET OverallQuality = 5 WHERE
> SessionName=" & dbconnection.ToSQL("TTD",ccsText))
>
> The following is intended to update the column with the value of the label
> Average in grid Results but does not change the column nor does it create
an
> error:
> dbconnection.Execute("UPDATE sessions SET OverallQuality =
> Results.Average.value WHERE SessionName=" &
dbconnection.ToSQL("TTD",ccsText))
> _________________
> Regards,
> David Hodgdon
> ---------------------------------------
> Sent from YesSoftware forum
> http://forums.codecharge.com/
>


Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

Web Database

Join thousands of Web developers who build Web applications with minimal coding.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.