www.gusucode.com > 耐品图片管理系统 标准版A > 耐品图片管理系统 标准版A/Inc/Conn.asp

    <%@ Language = "VBScript" CodePage = 936%>
<%
'===============================================================
' 著作权号:中国国家版权局著作权登记号2004SR07385
' 版权所有:深圳市耐品科技开发有限公司 www.naipin.com
' 联系电话:0755-26611119 81234844 81234845
' 联系手机:13316911914
' 联系邮箱:naipin@naipin.com
'===============================================================

Response.Buffer = True

Const MsxmlVersion=".3.0"
Const CookieName = "Netpic"

Dim Conn,ConnStr,DataFile
Startime = Timer()

'可修改设置一:========================定义数据库类别,1为SQL数据库,0为Access数据库=============================
Const IsSqlDataBase = 0
'================================================================================================================
If IsSqlDataBase = 1 Then
	'必修改设置二:========================SQL数据库设置=============================================================
	'sql数据库连接参数:连接名(SqlLocalName)(本地用local,外地用IP)、用户名(SqlUsername)、用户密码(SqlPassword)、数据库名(SqlDatabaseName)
	Const SqlLocalName = "(local)"
	Const SqlUsername = "sa"
	Const SqlPassword = "001225"
	Const SqlDatabaseName = "v90pic"
	'================================================================================================================
	DateString = Array("GetDate()","yyyy","m","d","hh","n","s","'")
	
	ConnStr = "driver={SQL SERVER};uid=" & SqlUsername & ";pwd=" & SqlPassword & ";database=" & SqlDatabaseName & ";server=" & SqlLocalName & ";"
Else
	'必修改设置三:========================Access数据库设置==========================================================
	DataFile = server.MapPath("data/#Photo.mdb")
	'================================================================================================================
	DateString = Array("Now()","'yyyy'","'m'","'d'","'h'","'n'","'s'","#")
	
	ConnStr = "Provider = Microsoft.Jet.OLEDB.4.0;Data Source = " & DataFile
End If

'On Error Resume Next
Set Conn = Server.CreateObject("ADODB.Connection")
Conn.Open ConnStr
If Err Then
	Err.Clear
	Set Conn = Nothing
	Response.Write "数据库连接出错,请检查连接字串。"
	Response.End
End If
	
Function Checked(value1,value2)
	Checked = " value="&Chr(34)&value2&Chr(34)
	If Lcase(value1&"")=Lcase(value2&"") Then Checked = Checked & " checked"
End Function

Function Selected(value1,value2)
	Selected = " value="&Chr(34)&value2&Chr(34)
	If Lcase(value1&"")=Lcase(value2&"") Then Selected = Selected & " selected"
End Function
%>