SqlClass.asp
上传用户:qfkgdy
上传日期:2020-06-18
资源大小:1888k
文件大小:1k
- <%
- Class SQLClass
-
- Dim table,list,columns,values
-
- Private Sub Class_Initialize
- Set list=Server.CreateObject("Scripting.Dictionary")
- End Sub
-
- Sub add(ByVal column,value,default,t)
- if(isempty(value)) then
- value=default
- end if
- if(t=1) then
- value="'"&value&"'"
- end if
- list.add column,value
- End Sub
-
- Function insert()
- Dim keys,items,li,lc
- keys=list.keys
- items=list.items
- lc=list.count-1
- for li=0 to lc
- if(li<>0) then
- columns=columns&","&keys(li)
- values=values&","&items(li)
- else
- columns=keys(li)
- values=items(li)
- end if
- next
- insert="INSERT INTO "&table&"("&columns&") VALUES("&values&")"
- End Function
-
- Function com(ByVal cases,connector,sql)
- if(connector="") then
- connector="AND"
- end if
- Dim cn,sn
- cn=UBound(cases)
- sn=0
- for i=0 to cn-1
- if(cases(i)<>"") then
- if(sn=0) then
- com=" WHERE "&cases(i)
- sn=1
- else
- com=com&" "&connector&" "&cases(i)
- end if
- end if
- next
- com=sql&com
- End Function
-
- Private Sub Class_Terminate
- Set list=nothing
- End Sub
- End Class
- %>