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
|
 |
 |
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
|
 |
 |
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
|
 |
 |
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/
>
|
|
|
 |
|