<%
Class DBClass
	Public Function Query(Byval s)
			Query = Request.querystring(s)
	End Function

	Public Function Show(Byval s)
			Show = Response.Write(s)
	End Function

	Public Function Sql(Byval s)
			If CheckSql(s) = True Then
					Set Sql = conn.execute(s)
			Else
					response.write(s &"含有非法字符！")
			End If
	End Function

	rem set rs = LebiOpen(10,"rs","lebi_product","product_name","id=100","sj desc")
	Public Function LebiOpen(top,rs,table,column,where,order)
			LebiOpen = conn.execute("select top "& column &" from ["& table &"] where "& where &" order by "& order &"")
	End Function

	Private Function CheckSql(Byval s)
			CheckSql = True
			dim sql_injdata,SQL_inj,SQL_Get,SQL_Data,Sql_Post
			SQL_injdata = ";|exec|insert|delete|update|master|truncate|char|declare"
			SQL_inj = split(SQL_Injdata,"|")
			For SQL_Data=0 To Ubound(SQL_inj)
					If instr(s,Sql_Inj(Sql_DATA))>0 Then
							CheckSql = False
							Exit Function
					End If
			Next
	End Function
'
'    Private rs,i,length,tablePrefixKey,tablePrefixValue,temp
'    Private sql,sqlSet,sqlItemKey,sqlItemValue,sqlWhere
'    Public rowsAffected
'    Private Sub Class_Initialize()
'        i = 0
'        length = 0
'        tablePrefixKey = ""
'        tablePrefixValue = "^o^"
'        temp = ""
'        sql = ""
'        sqlSet = ""
'        sqlItemKey = ""
'        sqlItemValue = ""
'    End Sub
'    Private Sub class_terminate()
'        If IsObject(rs) Then rs.Close : Set rs = Nothing
'    End Sub
'    Public Property Let Prefix(Byval k,Byval v)
'        tablePrefixKey = k
'        tablePrefixValue = v
'    End Property
'    Public Property Let Default(Byval k,Byval v)
'        temp = VarType(v)
'        sqlItemKey = sqlItemKey & "," & k
'        Select Case temp
'            Case 1,2,3,4,5,6,11
'                sqlSet = sqlSet & "," & k & "=" & v
'                sqlItemValue = sqlItemValue & "," & v
'            Case 7
'                sqlSet = sqlSet & "," & k & "=#" & v & "#"
'                sqlItemValue = sqlItemValue & ",#" & v & "#"
'            Case Else
'                sqlSet = sqlSet & "," & k & "='" & Replace(v,"'","''") & "'"
'                sqlItemValue = sqlItemValue & ",'" & Replace(v,"'","''") & "'"
'        End Select
'    End Property
'    Private Function Query(Byval s)
'        s = Replace(s,tablePrefixKey,tablePrefixValue,1,1,1)
'        Set Query = conn.Execute(s,rowsAffected,&H0001)
'    End Function
'    Private Function Alter(Byval s,Byval type_)
'        Alter = False
'        If Trim(s) = "" Then Exit Function
'        sqlSet = Replace(sqlSet,",","",1,1)
'        sqlItemKey = Replace(sqlItemKey,",","",1,1)
'        sqlItemValue = Replace(sqlItemValue,",","",1,1)
'        If sqlWhere <> "" Then
'            If LCase(Left(sqlWhere,3)) = "and" Then
'                sqlWhere = " where " & Replace(sqlWhere,"and","",1,1,1)
'            Else
'                sqlWhere = " where " & sqlWhere
'            End If
'        End If
'        Select Case type_
'            Case "insert" : sql = "INSERT INTO " & s & "(" & sqlItemKey & ") VALUES(" & sqlItemValue & ")"
'            Case "update" : sql = "UPDATE " & s & " SET " & sqlSet & sqlWhere
'            Case "delete" : sql = "DELETE * FROM " & s & sqlWhere
'        End Select
'        sqlSet = ""
'        sqlItemKey = ""
'        sqlItemValue = ""
'        sqlWhere = ""
'        Query(sql)
'        Alter = True
'    End Function
'    Public Default Property Get Default(Byval s)
'        temp = LCase(Left(Trim(s),6))
'        Select Case True
'            Case temp = "insert" : Default = Alter(Replace(s,"insert:","",1,1,1),"insert")
'            Case temp = "update" : Default = Alter(Replace(s,"update:","",1,1,1),"update")
'            Case temp = "delete" : Default = Alter(Replace(s,"delete:","",1,1,1),"delete")
'            Case temp = "where:" : sqlWhere = Replace(s,"where:","",1,1,1)
'            Case Else : Set Default = Query(s)
'        End Select
'    End Property
End Class
%>