日期:2014-05-17  浏览次数:20835 次

请高手帮帮忙
<!--#include   file= "conn1.asp "-->
<%
domainname=   Request.ServerVariables( "Server_name ")
domain=   mid(domainname,instrRev(left(domainname,instrrev(domainname, ". ")-1), ". ")+1)

str   =   "com.cn|net.cn|org.cn|ac.cn|bj.cn|sh.cn|tj.cn|hn.cn "
strarr   =   split(str, "| ")
for   each   key   in   strarr
if   right(lcase(domainname),len(key))=key   then  
domainname   =   left(domainname,len(domainname)-3)
domain   =   mid(domainname,instrRev(left(domainname,instrrev(domainname, ". ")-1), ". ")+1)
domainname   =   domainname   &   ".cn "
domain   =   domain   &   ".cn "
exit   for
end   if
next
%>

<%
yum=left(domainname,instrrev(domainname, ".ddr.eb.cn ")-1)
set   ru=Server.CreateObject( "ADODB.Recordset ")
sql   =   "Select   *   from   ym   where   yum= "&yum
ru.open   sql,conn,1
if   not   ru.bof   and   not   ru.eof
Response.Write   " <script> alert( '*** '); </script> "
else
Response.Write   " <script> alert( '*** '); </script> "
end   if
Ru.Close
Set   Ru   =   Nothing
%>

这段代码     如果数据库中   存在   yum的话   显示正确。但是   如果不存在的话     就提示   您要访问的网页有问题,无法显示。

请帮帮忙。

------解决方案--------------------
把SQL語句改成:sql= "Select * From [ym] Where yum= ' "&yum& " ' " 試試
------解决方案--------------------
<%
yum=left(domainname,instrrev(domainname, ".ddr.eb.cn ")-1)
if yum = " " then response.redirect( "... ") : response.end
............
%>