|
 |
asp_databases thread: connection object subtlety -- close executes
Message #1 by "Barry Von Ahsen" <barry@c...> on Wed, 19 Mar 2003 17:39:25
|
|
I have a script that has records in one table, and permissions on that
record in another table. There are no links or associations between
tables. My asp code reads:
if request.form("delbutton") <> "" then
sql = "DELETE FROM proc_prices WHERE ID = " & request.form("priceid")
conn.execute sql
sql2 = "DELETE FROM proc_tablepermissions WHERE rid = " &
Request.Form("priceid") & " AND tid = 33001"
conn.execute sql2
response.write "<script
language=javascript>window.opener.location.reload();window.close();</script>"
end if
The code takes up to 90 seconds to have the opener refresh. The opener is
a data table that contains ~125 records. I'm assuming there is a subtle
way that the connection is working, but the 3 hits I'm making on the
database don't seem like they should take this long.
Thoughts, suggestions, better designs??
Thanks,
Barry
Message #2 by skip@f... on Fri, 21 Mar 2003 04:30:59
|
|
Try closing the connection before you end the page. Orphaned connections
can be a drag.
There's something about that JavaScript that's bothering me, too. There
seems to be some strange interactions between pages parent-child windows.
I've found that it's better to invoke functions on other pages,
particularly to callers/openers, to close a child window, rather than
attempt to close the child from itself.
So, with that in mind, try something like this:
[On the Caller]
function cleanUpAndReload(w) {
w.close();
self.location.reload();
}
[On the Child window]
function allDone() {
if(opener) if(opener.cleanUpAndReload) opener.cleanUpAndReload(self);
}
Let us know how you make out,
Skip
|
|
 |