Has anyone ever encountered a problem where a SQL query from a classic ASP page returns partial results, but no errors?
I have a situation where a particular query on a page (one of many throughout the system) is returning a different number of rows each time it is run, and always less than the "correct" number, as determined by running the SQL against the server directly.
I think this may be related to the connection timeout (since this occurs with a long-running query and my timing shows that it is returning very close to the timeout), but I am receiving no timeout errors. Instead, as far as I can tell, it causes no errors, and returns a valid DataSet
which the code then loops over to build the results table.
Since there is no indication that an error has occurred, there is no suggestion that the data is not complete which means that users can no longer trust this report. Generally with this system, where SQL timeouts do occur frequently for "large" queries, we get error messages displayed on the page.
Investigations
Has anyone run into a situation where a SQL query from a classic asp page only returns partial results, and is there any way to check for or prevent this condition?
Setup :
ADODB.Connection
objects for connecting to the DB2 server backend databases. Shared connection initilization as follows:
connString = "Provider=MSDASQL.1;User ID=xxx;Data Source=XXX;Extended Properties=""DSN=XXX;UID=XXX;PWD=XXX;"""
Set conn = Server.CreateObject( "ADODB.Connection" )
Set cmd = Server.CreateObject("ADODB.Command")
conn.Mode = adOpenReadOnly
conn.Open connString
cmd.ActiveConnection = conn
cmd.CommandTimeout = 600
Usage as follows:
query = " SELECT blah FROM Foo WHERE ... " ' big long list of clauses defined from user selections.
cmd.CommandText = sql
Set oRs = cmd.Execute
Resposne.Write "<table>..." ' Write table headers here'
Do while (Not oRs.eof)
Response.Write "<tr>...</tr>" ' WRite details from oRs here
oRs.MoveNext
Loop
Response.Write "</table>"
尝试向查询中添加order by
,这样它应该一次发送所有行,并且可以排除超时问题
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.