SQL 2000 (MSDE) Hangs When It Receives an Erroneous Query from a Classic ASP Web Application
Posted
by Jimbo
on Stack Overflow
See other posts from Stack Overflow
or by Jimbo
Published on 2010-03-26T06:16:35Z
Indexed on
2010/03/26
6:23 UTC
Read the original article
Hit count: 548
I have a SQL interface page in my classic ASP web app that allows admin users to run queries against the app's database (MSDE 2000) - it simply consists of a textarea that the user submits and the app returns the resulting list of records as below
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
The problem with this is that if you send it an invalid query (with a spelling mistake, invalid join etc.) instead of throwing back an error immediately, it hangs IIS (you can see this by trying to browse the app from another computer, it fails) for a number of minutes and THEN returns the error. I have NO idea why! Can anyone help?
© Stack Overflow or respective owner