动网论坛的asp 数据库连接代码

网络编程 2021-07-05 10:58www.168986.cn编程入门
动网论坛的asp程序,在一定程度了,成了asp的顶峰之作。高手
代码如下:

<%@LANGUAGE="VBSCRIPT"%>
<%
option explicit
dim startime,endtime,conn,strCon,db
startime=timer()

Dim strSQLServerName
Dim strSQLDBUserName
Dim strSQLDBPassword
Dim strSQLDBName

'请填写数据库具体参数
'-----------------------------------------------------------------------------------------------
strSQLServerName = "127.0.0.1" '服务器名称或地址
strSQLDBUserName = "sa" '数据库帐号
strSQLDBPassword = "123" '数据库密码
strSQLDBName = "bbsbak" '数据库名称
'-----------------------------------------------------------------------------------------------

'SQL Server OLE Driver
Set conn = Server.CreateObject("ADODB.Connection")
strCon = "Provider=SQLOLEDB;Server=" & strSQLServerName & ";User ID=" & strSQLDBUserName & ";Password=" & strSQLDBPassword & ";Database=" & strSQLDBName & ";"

conn.Open strCon


function CloseDatabase
Conn.close
Set conn = Nothing
End Function
%>

Copyright © 2016-2025 www.168986.cn 狼蚁网络 版权所有 Power by