asp代码收集
1
'----------------------------------------------------------------------------
2
'函数原型:OpenConn(ByRef dbConn)
3
'功能说明:根据指定的数据库路径打开一个连接
4
'参数类型:dbConn待打开的数据库连接对象,已经定义的变量
5
'返 回 值:无
6
'创建日期:2004年5月20日
7
'最后修改:2004年5月20日
8
'----------------------------------------------------------------------------
9
Function OpenConn(ByRef dbConn)
10
If TypeName(dbConn)="Connection" Then
11
If dbConn.State<>adStateClosed Then dbConn.Close
12
dbConn.Open MM_Conn_String
13
Exit Function
14
End If
15
If TypeName(dbConn)="Empty" Then
16
Set dbConn=Server.CreateObject("ADODB.Connection")
17
dbConn.Open MM_Conn_String
18
Else
19
Err.Raise vbObjectError+1,"OpenConn(dbConn,strDbPath)","dbConn参数必须是空或者已经存在Connection对象的实例 [" & TypeName(dbConn) & "]"
20
End If
21
End Function
22
'----------------------------------------------------------------------------
23
'函数原型:CloseConn(ByRef dbConn)
24
'功能说明:关闭指定的连接,并且释放资源
25
'参数类型:dbConn待关闭的数据库连接对象,已经定义的变量
26
'返 回 值:无
27
'创建日期:2004年5月20日
28
'最后修改:2004年5月20日
29
'----------------------------------------------------------------------------
30
Public Function CloseConn(ByRef dbConn)
31
If TypeName(dbConn)<>"Connection" Then
32
Err.Raise vbObjectError+2,"CloseConn(dbConn)","dbConn参数必须是Connection对象的实例 [" & TypeName(dbConn) & "]"
33
End If
34
If dbConn.State<>adStateClosed Then dbConn.Close
35
Set dbConn=Nothing
36
End Function
37
'----------------------------------------------------------------------------
38
'函数原型:OpenCmd(ByRef cmdTemp,ByRef cnnTemp)
39
'功能说明:打开一个Command对象
40
'参数类型:cmdTemp 待代开的Command对象
41
' cnnTemp 指定的连接对象
42
'返 回 值:无
43
'创建日期:2004年5月20日
44
'最后修改:2004年5月20日
45
'----------------------------------------------------------------------------
46
Public Function OpenCmd(ByRef cmdTemp,ByRef cnnTemp)
47
If TypeName(cnnTemp)<>"Connection" Then
48
Err.Raise vbObjectError+7,"OpenCmd()","打开Command对象时未指定正确的Connection对象 [" & TypeName(cnnTemp) & "]"
49
Exit Function
50
End If
51
If cnnTemp.State=adStateClosed Then
52
Err.Raise vbObjectError+8,"OpenCmd()","打开Command对象时指定的Connection对象未正确打开"
53
Exit Function
54
End If
55
If TypeName(cmdTemp)="Command" Then
56
Set cmdTemp.ActiveConnection=cnnTemp
57
cmdTemp.CommandType=adCmdStoredProc
58
Exit Function
59
End If
60
If TypeName(cmdTemp)="Empty" Then
61
Set cmdTemp=Server.CreateObject("ADODB.Command")
62
Set cmdTemp.ActiveConnection=cnnTemp
63
cmdTemp.CommandType=adCmdStoredProc
64
Else
65
Err.Raise vbObjectError+9,"OpenCmd(cmdTemp,cnnTemp)","OpenCmd函数的cmdTemp参数必须是空或者已经定义的RecordSet对象 [" & TypeName(rstTemp) & "]"
66
End If
67
End Function
68
'----------------------------------------------------------------------------
69
'函数原型:CloseCmd(ByRef cmdTemp)
70
'功能说明:关闭指定的Command对象并且释放资源
71
'参数类型:cmdTemp待关闭的Command对象,已经定义的变量
72
'返 回 值:无
73
'创建日期:2004年5月20日
74
'最后修改:2004年5月20日
75
'----------------------------------------------------------------------------
76
Public Function CloseCmd(ByRef cmdTemp)
77
If TypeName(cmdTemp)<>"Command" Then
78
Err.Raise vbObjectError+10,"CloseCmd(cmdTemp)","cmdTemp参数必须是已定义的Command对象 [" & TypeName(dbConn) & "]"
79
Else
80
Set cmdTemp=Nothing
81
End If
82
End Function
83![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
2
![](/Images/OutliningIndicators/None.gif)
3
![](/Images/OutliningIndicators/None.gif)
4
![](/Images/OutliningIndicators/None.gif)
5
![](/Images/OutliningIndicators/None.gif)
6
![](/Images/OutliningIndicators/None.gif)
7
![](/Images/OutliningIndicators/None.gif)
8
![](/Images/OutliningIndicators/None.gif)
9
![](/Images/OutliningIndicators/None.gif)
10
![](/Images/OutliningIndicators/None.gif)
11
![](/Images/OutliningIndicators/None.gif)
12
![](/Images/OutliningIndicators/None.gif)
13
![](/Images/OutliningIndicators/None.gif)
14
![](/Images/OutliningIndicators/None.gif)
15
![](/Images/OutliningIndicators/None.gif)
16
![](/Images/OutliningIndicators/None.gif)
17
![](/Images/OutliningIndicators/None.gif)
18
![](/Images/OutliningIndicators/None.gif)
19
![](/Images/OutliningIndicators/None.gif)
20
![](/Images/OutliningIndicators/None.gif)
21
![](/Images/OutliningIndicators/None.gif)
22
![](/Images/OutliningIndicators/None.gif)
23
![](/Images/OutliningIndicators/None.gif)
24
![](/Images/OutliningIndicators/None.gif)
25
![](/Images/OutliningIndicators/None.gif)
26
![](/Images/OutliningIndicators/None.gif)
27
![](/Images/OutliningIndicators/None.gif)
28
![](/Images/OutliningIndicators/None.gif)
29
![](/Images/OutliningIndicators/None.gif)
30
![](/Images/OutliningIndicators/None.gif)
31
![](/Images/OutliningIndicators/None.gif)
32
![](/Images/OutliningIndicators/None.gif)
33
![](/Images/OutliningIndicators/None.gif)
34
![](/Images/OutliningIndicators/None.gif)
35
![](/Images/OutliningIndicators/None.gif)
36
![](/Images/OutliningIndicators/None.gif)
37
![](/Images/OutliningIndicators/None.gif)
38
![](/Images/OutliningIndicators/None.gif)
39
![](/Images/OutliningIndicators/None.gif)
40
![](/Images/OutliningIndicators/None.gif)
41
![](/Images/OutliningIndicators/None.gif)
42
![](/Images/OutliningIndicators/None.gif)
43
![](/Images/OutliningIndicators/None.gif)
44
![](/Images/OutliningIndicators/None.gif)
45
![](/Images/OutliningIndicators/None.gif)
46
![](/Images/OutliningIndicators/None.gif)
47
![](/Images/OutliningIndicators/None.gif)
48
![](/Images/OutliningIndicators/None.gif)
49
![](/Images/OutliningIndicators/None.gif)
50
![](/Images/OutliningIndicators/None.gif)
51
![](/Images/OutliningIndicators/None.gif)
52
![](/Images/OutliningIndicators/None.gif)
53
![](/Images/OutliningIndicators/None.gif)
54
![](/Images/OutliningIndicators/None.gif)
55
![](/Images/OutliningIndicators/None.gif)
56
![](/Images/OutliningIndicators/None.gif)
57
![](/Images/OutliningIndicators/None.gif)
58
![](/Images/OutliningIndicators/None.gif)
59
![](/Images/OutliningIndicators/None.gif)
60
![](/Images/OutliningIndicators/None.gif)
61
![](/Images/OutliningIndicators/None.gif)
62
![](/Images/OutliningIndicators/None.gif)
63
![](/Images/OutliningIndicators/None.gif)
64
![](/Images/OutliningIndicators/None.gif)
65
![](/Images/OutliningIndicators/None.gif)
66
![](/Images/OutliningIndicators/None.gif)
67
![](/Images/OutliningIndicators/None.gif)
68
![](/Images/OutliningIndicators/None.gif)
69
![](/Images/OutliningIndicators/None.gif)
70
![](/Images/OutliningIndicators/None.gif)
71
![](/Images/OutliningIndicators/None.gif)
72
![](/Images/OutliningIndicators/None.gif)
73
![](/Images/OutliningIndicators/None.gif)
74
![](/Images/OutliningIndicators/None.gif)
75
![](/Images/OutliningIndicators/None.gif)
76
![](/Images/OutliningIndicators/None.gif)
77
![](/Images/OutliningIndicators/None.gif)
78
![](/Images/OutliningIndicators/None.gif)
79
![](/Images/OutliningIndicators/None.gif)
80
![](/Images/OutliningIndicators/None.gif)
81
![](/Images/OutliningIndicators/None.gif)
82
![](/Images/OutliningIndicators/None.gif)
83
![](/Images/OutliningIndicators/None.gif)