程序的功能有了個大體的框架
變量然後通過INIT() 來選擇不同類型的數據庫
<%
Class ConnEx
public ConnEx
public DBpath
public DBtype
public ConnMethod
public User
public Pass
Sub Class_initialize
End Sub
Sub Init()
ConnStr =
Set ConnEx = Server
ConnEx
CatchError(
End Sub
Sub CatchError( Str )
If Err Then
Err
Class_Terminate()
Response
Response
End If
End Sub
Function HasRecordBySql( Sql )
Call CheckSql(Sql
Dim Rs
Set Rs = ConnEx
CatchError(
If Not (Rs
HasR = False
Else
HasR = True
End If
Rs
Set Rs = Nothing
HasRecordBySql = HasR
End Function
Function HasRecordById( StrTableName
Dim Rs
Sql =
Call CheckSql(Sql
Set Rs = ConnEx
CatchError(
If Not (Rs
HasR = False
Else
HasR = True
End If
Rs
Set Rs = Nothing
HasRecordById = HasR
End Function
Function GetRsBySql( Sql )
Call CheckSql(Sql
Dim Rs
Set Rs = Server
Rs
Set GetRsBySql = Rs
End Function
Function GetValueBySql( Sql )
Call CheckSql(Sql
Dim Rs
Set Rs = ConnEx
CatchError(
If Not( Rs
ReturnValue = Rs(
Else
ReturnValue =
End If
Rs
Set Rs = Nothing
GetValueBySql = ReturnValue
End Function
Function UpdateBySql( Sql )
Call CheckSql(Sql
ConnEx
CatchError(
UpdateBySql = True
End Function
Function InsertBySql(Sql)
Call CheckSql(Sql
ConnEx
CatchError(
InsertBySql = True
End Function
Function DeleteBySql( Sql )
Call CheckSql(Sql
ConnEx
CatchError(
DeleteBySql = True
End Function
Sub CheckSql( Sql
Dim StrSql
StrSql = Lcase(Sql)
SinCounts =
DouCounts =
For i =
If Mid(StrSql
If Mid(StrSql
Next
If (SinCounts Mod
Call Class_Terminate()
Response
Response
End If
Select Case Flag
Case
If Instr(StrSql
Class_Terminate()
Response
Response
End If
Case
If Instr(StrSql
Class_Terminate()
Response
Response
End If
Case
Case Else:
Response
End Select
End Sub
Sub Class_Terminate
If Not IsEmpty(FriendConn) Then
FriendConn
Set FriendConn = Nothing
CatchError()
End If
End Sub
End Class
%>
From:http://tw.wingwit.com/Article/program/net/201311/11318.html