Function Open_conn() dim Conn,Strconn set Conn=server.createobject("adodb.connection") Strconn = "Provider = Sqloledb; User ID = 数据库登录帐号; Password = 数据库登录密码; Initial Catalog = 数据库名称; Data Source = (local);" Conn.open Strconn set Open_conn=Conn If Err Then err.Clear Conn.close:set Conn=nothing Response.Write "对不起,数据库连接出错。" Response.End End If End Function