PDA

View Full Version : How to stop the process of reading from database?


bostjank
01-02-2003, 12:22 PM
Hello!

I have pages in ASP that read from Access database. Search results are shown in HTML tables that have up to 2300 rows.
Sometimes users dont want to wait for the whole table to be displayed (because they clicked the wrong search button or for some other reason) and they click 'Stop' button in a browser (or Back or press Esc).

The result is that the process stops. But not completely. If a user clicks another on some other link or tries to do something else nothing happens for a long time (approximately so long as it would take for the whole table to be displayed).

How can I stop the process completely?


This is the script I use for reading from database:

<%
Response.Buffer = True

sConn = "DRIVER={Microsoft Access Driver (*.mdb)};DBQ=" & Server.MapPath("......")
Set conn = Server.CreateObject("adodb.connection")
conn.open sConn,"",""

sSQL = "SELECT ..."
set rs = connn.Execute(sSQL)

Do While Not rs.EOF
...
Response.Flush
rs.MoveNext
Loop
%>


Thanks,
Bostjan :thumbsup:

Ledevin
01-02-2003, 09:35 PM
I didn't try it myself, but you could use this:


object.Cancel

You could create a button with the Cancel Object so that users could click the button to stop the recordset.

whammy
01-02-2003, 11:28 PM
You could also use database paging to only display a certain amount of rows per page. I don't know of any good links offhand, but you should be able to find some good links/tutorials by doing a search like "database paging ASP" on google... there's also an example under the post "Photo Gallery Scripts".

oracleguy
01-03-2003, 03:55 AM
http://www.cfdev.com/code_samples/code.cfm/CodeID/57/ASP/Paging_code


Here is one tutorial on database paging.

glenngv
01-03-2003, 05:48 AM
Do While Not rs.EOF and Response.IsClientConnected
...
Response.Flush
rs.MoveNext
Loop

here's a quick reference about Response.IsClientConnected (http://www.devguru.com/Technologies/asp/quickref/response_isclientconnect.html)