我們在寫asp數據庫程序的時候
下面讓我們看看這個類的代碼
<%
class SQLString
PRivate sTableName
Private Sub Class_Initialize()
sTableName=""
iSQLType=
sWhere=""
sOrder=""
sSQL=""
End Sub
Private Sub Class_Terminate()
End Sub
‘設置表名的屬性
Public Property Let TableName(value)
sTableName=value
End Property
‘設置條件
Public Property Let Where(value)
sWhere=value
End Property
‘設置排序方式
Public Property Let Order(value)
sOrder=value
End Property
‘設置查詢語句的類型
Public property Let SQLType(value)
iSQLType=value
select case iSQLType
case
sSQL="insert into #
case
sSQL="update #
case
sSQL="delete from #
case
sSQL="select #
end select
End Property
Public Sub AddField(sFieldName
select case iSQLType
case
sSQL=replace(sSQL
sSQL=replace(sSQL
case
sSQL=replace(sSQL
sSQL=replace(sSQL
case
sSQL=replace(sSQL
End Select
End Sub
Public Function ReturnSQL()
sSQL=replace(sSQL
select case iSQLType
case
sSQL=replace(sSQL
sSQL=replace(sSQL
case
sSQL=replace(sSQL
case
sSQL=replace(sSQL
end Select
if sWhere<>"" then
sSQL=sSQL & " where " & sWhere
end if
if sOrder<>"" then
sSQL=sSQL & " order by " & sOrder
end if
ReturnSQL=sSQL
End Function
Public Sub Clear()
sTableName=""
iSQLType=
sWhere=""
sOrder=""
sSQL=""
End Sub
end class
%>
使用方法
例句
set a =new SQLString ‘創建類對象
a
a
a
a
a
a
a
a
a
a
Response
set a=nothing
From:http://tw.wingwit.com/Article/program/net/201311/14270.html