%
'TO DO:
' cross-browser event handling (caption
' onclick, field on change)
'shouldn't use HTML tags for formatting,
' use CSS
'verify with all SQL Server types.
'add 'goto hyperlink' and 'sendmail' ico
' ns if field contains (only) a url
'fix maxlength. shows number of bits for
' numbers.
' end to do
Class CRecordEdit
Public moreTblTags
Public moreRowTags
Public moreCaptionTags
Public moreCellTags
Private m_iPKFld
Public Property Let uniqueField(ByVal p)
m_iPKFld=uniqueField
End Property
Private Sub class_initialize()
m_iPKFld=0
End Sub
Public Sub Print(ByRef rs)
With response
.write "
" & vbCr
Dim fld
For Each fld In rs.fields
.write vbTab & "
"
.write "
"
.write fld.name
.write "
"
.write "
"
Call showControl(fld)
.write "
"
.write "
" & vbCr
Next
.write "
"
.write vbCr & ""
.write vbCr & ""
.write vbCr & ""
.write vbCr & ""
.write vbCr & ""
.write vbCr & ""
End With
End Sub
Private Sub showControl(ByRef fld)
Dim name,val,maxLength,width,ftype
name=fld.name
val=fld.value
maxLength=fld.definedSize
width=""
ftype=fld.type
'took out widths, use CSS
Select Case ftype
Case 7,135 'dates
maxLength=22
' width=21
Case 3,4,5,6
maxLength=99 'should figure this out actually
Case 2 'adSmallInt (-32,000)
maxLength=7
' width=7
Case 72 'GUID
maxLength=38
' width=43
Case 17 'byte
maxlength=3
' width=3
End Select
Select Case ftype
Case 3,17,2,131,5,6,4,130,129,202,200,72,7,135 'regular text
With response
.write "0 Then .write " maxlength=""" & maxLength & """"
' if len(width)>0 then .write " s
' ize=""" & width & """"
.write " onFocus=""this.select();"""
.write " " & moreCellTags
.write ">"
End With
Case 203,201 'memo
With response
.write ""
End With
Case 11 'boolean
With response
.write ""
End With
Case Else
Response.Write ""
End Select
With response
.write vbCr & vbTab & ""
.write vbCr & vbTab & ""
End With
End Sub
End Class
%>