我从数据库中按照如下语句选择记录,
sqlTS1="select * from tblReports where Sections='TS' and ReportMonth='"& ReportMonth &"' and ReportWeek='Week1'"
Set rsts1=conn.execute (sqlTS1)
但是当记录中没有"Week1"时总出现错误页面,
如何当没有匹配字符时就显示空记录呀?
...全文
1349打赏收藏
提取数据出错,该如何处理呢?
我从数据库中按照如下语句选择记录, sqlTS1="select * from tblReports where Sections='TS' and ReportMonth='"& ReportMonth &"' and ReportWeek='Week1'" Set rsts1=conn.execute (sqlTS1) 但是当记录中没有"Week1"时总出现错误页面, 如何当没有匹配字符时就显示空记录呀?
set rs=server.createobject("adodb.recordset")
sqlTS1="select * from tblReports where Sections='TS' and ReportMonth='"& ReportMonth &"' and ReportWeek='Week1'"
rs.open sqlTS1,conn,1,1
if rs.eof then
response.write "无记录!"
else
response.redirect "index.asp"
end if