无法调用SUB过程,大家进来帮下忙

来源:互联网 发布:恋爱纪念日软件 编辑:程序博客网 时间:2024/04/29 08:25
本人想在A页面调用B页面的连接数据库的过程    但是经过测试无法调用成功, 如果不调用SUB那么可以成功链接数据库  请问怎么解决  谢谢


不成功的情况
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
A页面
<!--#include file="conn.asp"-->
<%
call ConnectionDatabase
%>
B页面
<%
public Sub ConnectionDatabase
  dim conn
  Set conn = Server.CreateObject("ADODB.Connection")
  response.Write Server.MapPath("client.mdb")
  conn.open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source="&Server.MapPath("client.mdb")
If Err Then
err.Clear
Set Conn = Nothing
Response.Write "The Sever Is Busy,Please try again..."
Response.End
End If
End Sub
%>;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;





成功的情况
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
A页面
<!--#include file="conn.asp"-->
<%
'call ConnectionDatabase
%>
B页面
<%
'public Sub ConnectionDatabase
  dim conn
  Set conn = Server.CreateObject("ADODB.Connection")
  response.Write Server.MapPath("client.mdb")
  conn.open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source="&Server.MapPath("client.mdb")
If Err Then
err.Clear
Set Conn = Nothing
Response.Write "The Sever Is Busy,Please try again..."
Response.End
End If
'End Sub
%>;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
0 0