Vbscript| Object | The display is based on the code modified by MS, currently does not support editing, you can sort, query, pagination display
<%@ Language=vbscript%>
<% Option Explicit%>
<%
Class Classdatagrid
Private M_strsql
Private M_strconn
Private M_strrowcolor1
Private M_strrowcolor2
Private M_strmode
Private M_strprocesspage
Private M_strtitle
Private M_strrsname
Private M_strfindfields
Public Property Get SQL ()
SQL = M_strsql
End Property
Public Property Let SQL (strSQL)
M_strsql = strSQL
End Property
Public Property Get Conn ()
Conn = M_strconn
End Property
Public Property Let Conn (strconn)
M_strconn = strconn
End Property
Public Property Get RowColor1 ()
If IsNull (M_strrowcolor1) Or Len (M_strrowcolor1) = 0 Then
RowColor1 = "#ffffff"
Else
RowColor1 = M_strrowcolor1
End If
End Property
Public Property Let RowColor1 (StrRowColor1)
M_strrowcolor1 = StrRowColor1
End Property
Public Property Get RowColor2 ()
If IsNull (M_strrowcolor2) Or Len (M_strrowcolor2) = 0 Then
RowColor2 = "#00ffff"
Else
RowColor2 = M_strrowcolor2
End If
End Property
Public Property Let RowColor2 (StrRowColor2)
M_strrowcolor2 = StrRowColor2
End Property
Public Property Get Mode ()
If IsNull (M_strmode) Or Len (M_strmode) = 0 Then
Mode = "View"
Else
Mode = M_strmode
End If
End Property
Public Property Let Mode (Strmode)
If strmode <> "View" and Strmode <> "Edit" Then
Response.Write ("mode error--View and edit<br> only allowed")
Response.End
Else
M_strmode = Strmode
End If
End Property
Public Property Get Processpage ()
Processpage = M_strprocesspage
End Property
Public Property Let Processpage (Strprocesspage)
M_strprocesspage = Strprocesspage
End Property
Public Property Get Title ()
If IsNull (m_strtitle) Or Len (m_strtitle) = 0 Then
Title = "Data Grid"
Else
Title = M_strtitle
End If
End Property
Public Property Let Title (Strtitle)
M_strtitle = Strtitle
End Property
Public Property Get Rsname ()
If IsNull (m_strrsname) Or Len (m_strrsname) = 0 Then
Rsname = "Grid"
Else
Rsname = M_strrsname
End If
End Property
Public Property Let Rsname (Strrsname)
M_strrsname = Strrsname
End Property
Public Property Get Findfields ()
Findfields = M_strfindfields
End Property
Public Property Let Findfields (Strfindfields)
M_strfindfields = Strfindfields
End Property
Sub Showdatagrid ()
Dim Intpagenum
Dim objconn
Dim objRS
Dim Intabs
Dim Intcurrentpage
Dim Intfindcol
Dim intpagesize
Dim introw
Dim Intcol
Dim I
Dim intpos
Dim intdisplayrows
Dim StrSort
Dim Strsortdir
Dim Strlastsort
Dim Strlastsortdir
Dim Strcolor
Dim Strfind
Dim Boolfind
Dim Boolfound