VBScript編碼模板(2003-11-14修改版) (轉)

amyz發表於2007-08-16
VBScript編碼模板(2003-11-14修改版) (轉)[@more@]

<!-- METADATA
TYPE="typelib"
FILE="C:Program FilesCommon FilesSystemADOmsado20.tlb"
--&gt

Option Explicit
'=========================================================
'容錯機制程式碼
'=========================================================
 DIM NDE_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
'連線引數:資料庫名、密碼、使用者名稱、連線名(本地用local,外地用IP)
 Dim SqlDatabaseName,SqlPass,SqlUsername,SqlLocalName
 SqlDatabaseName="xiaods"
 SqlPassword="!QAZXSW@"
 SqlUsername="xiaods"
 SqlLocalName="192.168.211.7"
 ConnStr = "Provr=Sqlole; User ID=" & SqlUsername & "; Password=" & SqlPassword & "; Initial Catalog = " & SqlDatabaseName & "; Data =" & SqlLocalName & ";"
 'on error resume next
 Set oConn = Server.Create("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 " " & vbCrLf
response.write "

" & vbCrLf
response.write " 亞聯遊戲後臺管理" & vbCrLf
response.write " " & vbCrLf
response.write "" & vbCrLf
response.write " " & vbCrLf
response.write "" & vbCrLf
response.write " " & vbCrLf
response.write "" & vbCrLf
response.write "  " & vbCrLf
response.write "  " & vbCrLf
response.write "  " & vbCrLf
response.write "
" & vbCrLf
response.write "" & vbCrLf
response.write "  " & vbCrLf
response.write "  " & vbCrLf
response.write "  " & vbCrLf
response.write "  " & vbCrLf
response.write " 
"&  sErrmsg&"
" & vbCrLf
response.write "  " & vbCrLf
response.write "  " & vbCrLf
response.write "  " & vbCrLf
response.write "  " & vbCrLf
response.write "  " & vbCrLf
response.write "  " & vbCrLf
response.write "  " & vbCrLf
response.write " 
您要瀏覽的頁面有錯誤,請勿遲疑,立即與master@asiagame.com">mailto:webmaster@asiagame.com"">員聯絡。" & vbCrLf
response.write " 

If you have any problem, please " & vbCrLf
response.write "  don't hesitate to contact the response.write "  Administrator.

亞聯遊戲
" & vbCrLf
response.write "  Asiagame.com
" & vbCrLf
response.write "" & vbCrLf
response.write " 
"
response.write " " & vbCrLf
response.write " "
end sub
'ConnectionDatabase 'open Datesrc
%>
此為修改版

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/10752019/viewspace-962626/,如需轉載,請註明出處,否則將追究法律責任。

相關文章