<!--#include file="../myconn.asp"-->========调用数据库
<%
Const SystemDatabaseType = "SQL"
Const DBFileName = "\database\111.mdb"
Const SqlUsername = "111"
Const SqlPassword = "111"
Const SqlDatabaseName = "111"
Const SqlHostIP = "(local)"
Dim Conn
Dim PE_True, PE_False, PE_Now, PE_OrderType, PE_DatePart_D, PE_DatePart_Y, PE_DatePart_M, PE_DatePart_W, PE_DatePart_H
Sub OpenConn()
'On Error Resume Next
Dim ConnStr
If SystemDatabaseType = "SQL" Then
ConnStr = "Provider = Sqloledb; User ID = " & SqlUsername & "; Password = " & SqlPassword & "; Initial Catalog = " & SqlDatabaseName & "; Data Source = " & SqlHostIP & ";"
Else
ConnStr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath(DBFileName)
End If
Set Conn = Server.CreateObject("ADODB.Connection")
Conn.open ConnStr
If Err Then
Err.Clear
Set Conn = Nothing
Response.Write "数据库连接出错,请检查myConn.asp文件中的数据库参数设置。"
Response.End
End If
If SystemDatabaseType = "SQL" Then
PE_True = "1"
PE_False = "0"
PE_Now = "GetDate()"
PE_OrderType = " desc"
PE_DatePart_D = "d"
PE_DatePart_Y = "yyyy"
PE_DatePart_M = "m"
PE_DatePart_W = "ww"
PE_DatePart_H = "hh"
Else
PE_True = "True"
PE_False = "False"
PE_Now = "Now()"
PE_OrderType = " asc"
PE_DatePart_D = "'d'"
PE_DatePart_Y = "'yyyy'"
PE_DatePart_M = "'m'"
PE_DatePart_W = "'ww'"
PE_DatePart_H = "'h'"
End If
End Sub
Sub CloseConn()
On Error Resume Next
If IsObject(Conn) Then
Conn.Close
Set Conn = Nothing
End If
Set regEx = Nothing
Set PE_Cache = Nothing
End Sub
%>