函数问题
文件一:conn.asp
sub opendb
on error resume next
dim connstr
Set conn=Server.CreateObject("ADODB.Connection")
'打开sqlserver数据库的连接语句
connstr="driver={SQL Server};server=liuyan;uid=sa;pwd=1234;database=sunstone;"
conn.open connstr
if err.number<>0 then
call diserror("打开数据库失败,出错的原因是:" & err.Description)
end if
end sub
文件二:
<!--#include file="include/conn.asp"-->
<%
opendb
if isobject(Conn) then
response.write "yes"
else
response.write "No1!"
end if
sql="select * from test"
set rs=conn.execute(sql)
%>
在第二个文件调用中,总是conn不是一个对象,好像根本就没有打开一样.
请问这是什么原因造成的?