?? conn.asp
字號:
<%@ LANGUAGE = VBScript CodePage = 936%>
<%
Option Explicit
Response.Buffer = True
Dim webPath
%>
<!--#include file="config.asp"-->
<%
Dim powerid
Dim DataPath,domain
Dim Comeurl
dim conn
Dim SqlNowString
Dim nowtit,action
domain=Request.ServerVariables("server_name")
'可修改設(shè)置一:========================定義數(shù)據(jù)庫類別,1為SQL數(shù)據(jù)庫,0為Access數(shù)據(jù)庫================================
Const IsSqlDataBase = 0
'================================================================================================================
If IsSqlDataBase = 1 Then
'必修改設(shè)置二:========================SQL數(shù)據(jù)庫設(shè)置=============================================================
'sql數(shù)據(jù)庫連接參數(shù):數(shù)據(jù)庫名(SqlDatabaseName)、用戶密碼(SqlPassword)、用戶名(SqlUsername)、
'連接名(SqlLocalName)(本地用local,外地用IP)
Const SqlDatabaseName = "cj_2007"
Const SqlPassword = ""
Const SqlUsername = "sa"
Const SqlLocalName = "(local)"
'===============================================================================================================
SqlNowString = "GetDate()"
Else
'必修改設(shè)置三:========================Access數(shù)據(jù)庫設(shè)置==========================================================
'用戶第一次使用請修改本處數(shù)據(jù)庫地址并相應(yīng)修改data目錄中數(shù)據(jù)庫名稱
DataPath="data/#123zh.mdb" '相對根目錄下絕對路徑
'================================================================================================================
SqlNowString = "Now()"
End If
ConnectionDatabase
Dim rs,id,sql
Dim totalput,pagedw,CurrentPage,page,PurviewChecked
Dim strFileName,sql_tables,Sql_Conditions,Sql_Condition,Sql_Lists,Sql_Sortings,Sql_Orders,Sql_Additional
Dim rs_web,rs_edit,dels,user_check
Dim fun_cel,nos_i,fun_get
Dim types,keyword
Dim formaction
Dim i
Dim webtit,sitename
Sub ConnectionDatabase
Dim ConnStr
If IsSqlDataBase = 1 Then
ConnStr = "Provider = Sqloledb; User ID = " & SqlUsername & "; Password = " & SqlPassword & "; Initial Catalog = " & SqlDatabaseName & "; Data Source = " & SqlLocalName & ";"
Else
ConnStr = "Provider = Microsoft.Jet.OLEDB.4.0;Data Source = " & Server.MapPath(webPath & DataPath)
End If
'On Error Resume Next
Set conn = Server.CreateObject("ADODB.Connection")
conn.open ConnStr
If Err Then
err.Clear
Set Conn = Nothing
Autopath
Response.End
End If
End Sub
Sub Autopath()
Dim ScriptAddress,inpath,contentstr,filepath,filepath2
Dim obj_fso,obj_fso2
Dim obj_file,obj_file2
ScriptAddress = CStr(Request.ServerVariables("SCRIPT_NAME")) '虛擬目錄+文件
inpath=Split(ScriptAddress,"/")
ScriptAddress=Replace(ScriptAddress,inpath(UBound(inpath)),"")
'文件內(nèi)容開始
contentstr="%" & vbCrLf
contentstr=contentstr & "webPath=""" & ScriptAddress & """" & vbCrLf
contentstr=contentstr & "%"
'文件內(nèi)容結(jié)束
filepath=server.mappath("config.asp")
set obj_fso=server.createobject("scripting.filesystemobject")
if obj_fso.fileexists(filepath) then
set obj_file=obj_fso.opentextfile(filepath,2,false)
obj_file.write contentstr
obj_file.close
set obj_file=Nothing
Else
filepath2=server.mappath("../config.asp")
set obj_fso2=server.createobject("scripting.filesystemobject")
if obj_fso2.fileexists(filepath2) then
set obj_file2=obj_fso2.opentextfile(filepath2,2,false)
obj_file2.write " <" & Replace(contentstr,ScriptAddress,Replace(ScriptAddress,"admin/","")) & "> "
obj_file2.close
set obj_file2=Nothing
'Response.Redirect "../index.asp"
response.write "<SCRIPT LANGUAGE=""JavaScript"">window.location.reload();</SCRIPT>"
else
response.write "數(shù)據(jù)庫路徑錯誤,請自行修改根目錄下conn.asp文件!"
End If
end If
End Sub
%>
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -