An Erroneous SQL Query makes browser hang until script timeout exceeded
- by Jimbo
I have an admin page in a Classic ASP web application that allows the admin user to run queries against the database (SQL Server 2000)
Whats really strange is that if the query you send has an error in it (an invalid table join, a column you've forgotten to group by etc) the BROWSER hangs (CPU usage goes to maximum) until the SERVER script timeout is exceeded and then spits out a timeout exceeded error (server and browser are on different machines, so not sure how this happens!) I have tried this in IE 8 and FF 3 with the same result.
If you run that same query (with errors) directly from SQL Enterprise Manager, it returns the real error immediately. Is this a security feature? Does anyone know how to turn it off? It even happens when the connection to the database is using 'sa' credentials so I dont think its a security setting :(
Dim oRS
Set oRS = Server.CreateObject("ADODB.Recordset")
oRS.ActiveConnection = sConnectionString
// run the query - this is for the admin only so doesnt check for sql safe commands etc.
oRS.Open Request.Form("txtSQL")
If Not oRS.EOF Then
// list the field names from the recordset
For i = 0 to oRS.Fields.Count - 1
Response.Write oRS.Fields(i).name & " "
Next
// show the data for each record in the recordset
While Not oRS.EOF
For i = 0 to oRS.Fields.Count - 1
Response.Write oRS.Fields(i).value & " "
Next
Response.Write "<br />"
oRS.Movenext()
Wend
End If