<% @ language = vbscript code = 936%> <% option explicit '= ============================================================================================================================================================================================================= ====== 'Unlike Mechanism Code' ======================================== ================== Dim ndebug_msg ndebug_msg = false 'true, false
If ndebug_msg = true kil error filtering on Error ResMe Next End IF
'==================================================== ======== 'variable declaration and definition area' =================================== ======================
DIM Connstr, Oconn 'ADO Connection Variable DIM Serrmsg' Error Variable
'==================================================== ======== 'transaction definition area' ===================================== ===================== ============================================================================================================================================== ============================ 'func, the proc definition area' ================= =================================================================================================================================================================================
'==================================================== ======== 'function: Open the data source' parameter: 'Return value:' ============================ ============================= Sub connectionDatabase'sql database connection parameters: database name, user password, user name, connection name (local a local, field use IP) Dim SqlDatabaseName, sqlPassword, sqlUsername, SqlLocalName SqlDatabaseName = "xiaods" sqlPassword = sqlUsername = "xiaods" SqlLocalName = "192.168.211.7" ConnStr = "Provider = Sqloledb; User ID =" "QAZXSW @!" & 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 = "Database connection error, please check the connection string." MERROR (Serrmsg) End IFEND SUB
'==================================================== ======== 'function: Turn off the data source' parameter: 'Return value:' ============================ ============================= Sub closedatabaseoconn.closset Oconn = Nothingend Sub
'==================================================== ======== 'function: Output error message' parameter: serrmsg 'Return value:' =========================== ============================== Sub MERROR (Serrmsg) 'response.write serrmsg & "please contact system administrator." Response.write "& vbrlfresponse.write"
"& vbrlfresponse.write" & vbcrlfresponse.write "& vbcrfresponse.write"
|