dhodgdon
Posts: 80
|
| Posted: 04/30/2005, 9:07 PM |
|
I have queries in the MDB file that I would like to run in an After Initiaize event. Can this be done or do I need to place the SQL in the event and use the Execute method? The queries calculate an average value from one table's data and put it into another table. They need to run before the grid on the web page is built so that the calculated data that updates the table appears in the grid.
An example of the SQL in one of the queries in the MDB file is:
UPDATE Sessions INNER JOIN Results ON Sessions.SessionID = Results.SessionID SET Sessions.OverallQuality = DAvg("[ovrallsesquality]","results","[sessionid]='day1pres2'")
WHERE (([sessions].[sessionid]="day1pres2"));
If I have to use the Execute method, do I need to "open" and "close" the database connection like I do when I do a CCDLookUp, etc.?
Continuing this thought...the CCS help page on the Execute Method shows the syntax for an Update query as:
<connection>.Execute query
but it doesn't give an example of this syntax, only the syntax where a recordset is returned. So should the SQL be used "as is" and enclosed in quotes with any "internal" quotes changed to ""???
_________________
Regards,
David Hodgdon
|
 |
 |
Nicole
Posts: 586
|
| Posted: 05/03/2005, 4:58 AM |
|
David,
This Help article provides a sample code for executing custom sql queries http://docs.codecharge.com/studio/html/ProgrammingTechn...tomSQL.html?toc
Hope it helps
_________________
Regards,
Nicole |
 |
 |
Oper
Posts: 1195
|
| Posted: 05/03/2005, 9:42 AM |
|
David just use the query same way you using your table.
Just keep in mind query arent updatble (99% of the time)
http://www.GlobalDevelop.com
_________________
____________________________
http://www.7bz.com (Free CMS,CRM Developed in CCS)
http://www.PremiumWebTemplate.com
Affiliation Web Site Templates
Please do backup first |
 |
 |
dhodgdon
Posts: 80
|
| Posted: 05/05/2005, 5:05 AM |
|
I am creating a new post on this as a result of what I found. The subject will be more appropriate to those who may search for similar solutions. It is titled Sums, Averages and other calculated values.
_________________
Regards,
David Hodgdon
|
 |
 |
|