我循环遍历MSSQL数据库中的表,并构建一个变量来保存一些数据。表中有3000多行。
我的问题是当我调用函数时系统会永远加载。如果我禁用变量构建,则查询将在几秒钟内执行。
示例:
Set rs = dbConn.Execute("Select x, y, z From MyTable")
Do until rs.EOF
strData = strData & rs("x") & ","
strData = strData & rs("y") & ","
strData = strData & rs("z") & vbCrlf
rs.MoveNext
Loop
Set rs = Nothing
最后我做了:
Response.Clear
Response.Buffer = True
Response.AddHeader "Content-Disposition", "attachment;filename=export.csv"
Response.ContentType = "application/octet-stream"
Response.Write strData
Response.End
我该怎样做呢?