我正在对旧的 Classic ASP 网站进行一些更新。有一个表格,其中包含几列文本数据和一个日期时间字段。我需要从表中的所有值中获取唯一年份的列表。我试过这个:
set objConnection = Server.CreateObject("ADODB.Connection")
objConnection.ConnectionString = "Provider=SQLNCLI10;Server=localhost;Database=mydb;Uid=myuser;Pwd=something;"
objConnection.Open
set objRst = objConnection.execute("SELECT DISTINCT(YEAR(report_date)) AS report_year FROM report;")
if not objRst.eof then
do while not objRst.eof
response.write objRst("report_year")
objRst.movenext
loop
end if
但是当我在页面中运行这个脚本时,它什么也不做——最终脚本超时。
谁能建议如何做到这一点?谢谢!