27 lines
711 B
Plaintext
27 lines
711 B
Plaintext
|
<%
|
||
|
Private Sub SqlExec(ByVal ConnString, ByVal SQL)
|
||
|
Dim objCn, bErr1, bErr2, strErrDesc
|
||
|
On Error Resume Next
|
||
|
Set objCn = Server.CreateObject("ADODB.Connection")
|
||
|
objCn.Open ConnString
|
||
|
If Err Then
|
||
|
bErr1 = True
|
||
|
Else
|
||
|
objCn.Execute SQL
|
||
|
If Err Then
|
||
|
bErr2 = True
|
||
|
strErrDesc = Err.description
|
||
|
End If
|
||
|
End If
|
||
|
objCn.Close
|
||
|
Set objCn = Nothing
|
||
|
On Error GoTo 0
|
||
|
If bErr1 Then
|
||
|
Err.Raise 5109, "SqlExec Statement", "Bad connection " & _
|
||
|
"string. Database cannot be accessed."
|
||
|
ElseIf bErr2 Then
|
||
|
Err.Raise 5109, "SqlExec Statement", strErrDesc
|
||
|
End If
|
||
|
End Sub
|
||
|
%>
|