<!-- METADATA
TYPE="typelib"
FILE="C:\Program Files\Common Files\System\ADO\msado20.tlb"
-->
<%@ LANGUAGE=VBScript CodePage=936%>
<%
Option Explicit
'=========================================================
'容错机制代码
'=========================================================
DIM NDEBUG_MSG
NDEBUG_MSG=FALSE 'TRUE,FALSE
IF NDEBUG_MSG = TRUE THEN
'出错过滤
ON ERROR RESUME NEXT
END IF
'=========================================================
'变量声明及定义区
'=========================================================
Dim ConnStr,oConn 'ADO连接变量
Dim sErrmsg '错误变量
'=========================================================
' 事务定义区
'=========================================================
'=========================================================
'Func,Proc定义区
'=========================================================
'=========================================================
' 功能:打开数据源
' 参数:
' 返回值:
'=========================================================
Sub ConnectionDatabase
'sql数据库连接参数:数据库名、用户密码、用户名、连接名(本地用local,外地用IP)
Dim SqlDatabaseName,SqlPassword,SqlUsername,SqlLocalName
SqlDatabaseName="xiaods"
SqlPassword="!QAZXSW@"
SqlUsername="xiaods"
SqlLocalName="192.168.211.7"
ConnStr = "Provider=Sqloledb; User ID=" & SqlUsername & "; Password=" & SqlPassword & "; Initial Catalog = " & SqlDatabaseName & "; Data Source=" & SqlLocalName & ";"
'on error resume next
Set oConn = Server.CreateObject("ADODB.Connection")
oConn.open ConnStr
If Err Then
err.Clear
Set oConn = Nothing
sErrmsg= "数据库连接出错,请检查连接字串。"
mError(sErrmsg)
End If
End Sub
'=========================================================
' 功能:关闭数据源
' 参数:
' 返回值:
'=========================================================
Sub CloseDatabase
oConn.close
Set oConn = Nothing
End Sub
'=========================================================
' 功能:输出错误信息
' 参数:sErrmsg
' 返回值:
'=========================================================
sub mError(sErrmsg)
'Response.Write sErrmsg&"please contact system administrator."
response.write " <html>" & vbCrLf
response.write " <head>" & vbCrLf
response.write " <title>亚联游戏后台管理系统</title>" & vbCrLf
response.write " <meta NAME=""GENERATOR"" Content=""Microsoft Visual Studio 6.0"">" & vbCrLf
response.write "" & vbCrLf
response.write " </head>" & vbCrLf
response.write "" & vbCrLf
response.write " <body>" & vbCrLf
response.write "<table border=""0"" width=""100%"" height=""100%"" cellspacing=""0"" cellpadding=""0"">" & vbCrLf
response.write " <tr>" & vbCrLf
response.write " <td width=""100%"" valign=""middle"" align=""center"">" & vbCrLf
response.write "" & vbCrLf
response.write " <table border=""1"" width=""40%"" cellspacing=""0"" cellpadding=""4"" bordercolorlight=""#000080"" bordercolordark=""#000080"">" & vbCrLf
response.write " <tr>" & vbCrLf
response.write " <td width=""100%"" bgcolor=""#000080""><font color=""#FFFFFF"">"& sErrmsg&"</font></td>" & vbCrLf
response.write " </tr>" & vbCrLf
response.write " </table>" & vbCrLf
response.write " <table border=""1"" width=""40%"" bordercolorlight=""#000080"" cellspacing=""0"" cellpadding=""8"" bordercolordark=""#000080"">" & vbCrLf
response.write " <tr>" & vbCrLf
response.write " <td width=""100%"">您要浏览的页面有错误,请勿迟疑,立即与<a href=""mailto:[email protected]"">系统管理员</a>联系。" & vbCrLf
response.write " <p><font face=""Verdana"" size=""2"">If you have any problem, please " & vbCrLf
response.write " don't hesitate to contact the <a href=""Systems'>mailto:[email protected]"">Systems " & vbCrLf
response.write " Administrator</a>.</font></td>" & vbCrLf
response.write " </tr>" & vbCrLf
response.write " <tr>" & vbCrLf
response.write " <td width=""100%"" align=""center"">亚联游戏<br>" & vbCrLf
response.write " <font size=""2"">Asiagame.com</font></td>" & vbCrLf
response.write " </tr>" & vbCrLf
response.write " </table>" & vbCrLf
response.write "" & vbCrLf
response.write " </td>" & vbCrLf
response.write " </tr>" & vbCrLf
response.write "</table>"
response.write " </body>" & vbCrLf
response.write " </html>"
end sub
'ConnectionDatabase 'open Datesrc
%>
本文地址:http://com.8s8s.com/it/it9080.htm