Click here to Skip to main content
15,892,768 members
Articles / Web Development / IIS

Universal Table Editor

Rate me:
Please Sign up or sign in to vote.
4.86/5 (117 votes)
11 May 2003 1.6M   12.3K   275  
Viewer and Editor for any table in any Database you can reach from your IIS/PWS.
<%
'---------------------------------------------------------------------------
'
'   Project:    UTE - (U)niversal ASP (T)able (E)ditor
'
'   Module:     UTE class - Table Functions
'
'   Version:    2.10
'
'   Comments:   This module does the following things:
'                   1. defines all functions being needed in
'                      table view mode
'
'---------------------------------------------------------------------------
'
'   (c) in 2000-2002 by Tom Wellige                    
'   http://www.wellige.com  mailto:tom@wellige.com     
'                                               
'   This project is released under the "GNU General Public License (GPL)" 
'   http://www.gnu.org/licenses/gpl.html
'
'   and is maintained on SourceForge at
'   http://sourceforge.net/projects/ute-asp/
'
'   and can also be found on CodeProject at
'   http://www.codeproject.com/asp/ute.asp
'
'---------------------------------------------------------------------------


''--------------------------------------------------------------------------
'' Name:     InsertField
''           ===========
'' 
'' Returns HTML code for column header (i.e. field name)
''
'' Parameter: 
''		Field			field object
''
'' return value:
''		string
''
''--------------------------------------------------------------------------
Private Function InsertField ( Field )

	Dim s
	Dim sValue
	Dim sOrderDir
	Dim sOrderDescr
	Dim sOrderPic
	Dim bPicLink
	Dim sLinkPrefix
	Dim sLinkSuffix
	Dim sImg
	Dim sSort, sSortDir

	sSort    = m_SortFields(1)
	sSortDir = m_SortFieldsOrder(1)

	if (sSort <> Field.name) or (IsExcluded(Field.type)) then
		sOrderDir   = DEF_SORT_DIR
		if sOrderDir = SORT_ASC then
			sOrderDescr = STR_SORT_ASC
		else
			sOrderDescr = STR_SORT_DESC
		end if
		sOrderPic   = m_sIMAGEDir & "sort_none.gif"
		bPicLink    = False
	else
		if sSortDir = SORT_ASC then
			sOrderDir   = SORT_DESC
			sOrderDescr = STR_SORT_DESC
			sOrderPic   = m_sIMAGEDir & "sort_asc.gif"
		else '     -> SORT_DESC
			sOrderDir   = SORT_ASC
			sOrderDescr = STR_SORT_ASC
			sOrderPic   = m_sIMAGEDir & "sort_desc.gif"
		end if
		bPicLink = True
	end if

	sLinkPrefix = ""
	sLinkSuffix = ""

	if Not IsExcluded(Field.type) then
		s = Request.QueryString
		s = getLink(m_sUTEScript, s, sParamPage,    "1")			' switch to page one !
		s = getLink(m_sUTEScript, s, sParamSort & "1",    Field.name)
		s = getLink(m_sUTEScript, s, sParamSortDir & "1", sOrderDir)
		s = RemoveCountedParameters(s, sParamSort, 2)
		s = RemoveCountedParameters(s, sParamSortDir, 2)
		sLinkPrefix = "<a href=""" & s & """ title=""" & sOrderDescr & """ class=""ute_link"">"
		sLinkSuffix = "</a>"
	end if

	sValue = sLinkPrefix & Field.name & sLinkSuffix

	if sOrderPic <> "" then
		sImg = "<img src=""" & sOrderPic & """ border=""0"" alt=""" & sOrderDescr & """ " &_
				"width=""10"" height=""9"">"
		sValue = sValue & "&nbsp;" & sLinkPrefix & sImg & sLinkSuffix
	end if 

	InsertField = sValue & vbCrLf

End Function


''--------------------------------------------------------------------------
'' Name:     InsertFieldValue
''           ================
'' 
'' Returns HTML code for field value
''
'' Parameter: 
''		Field		field object
''
'' return value:
''		none
''
''--------------------------------------------------------------------------
Private Function InsertFieldValue ( Field ) 
	Dim sField
	Dim sValue

	if IsExcluded(Field.type) then
		sField = _
			"<center>" & _
				"<img src=""" & m_sIMAGEDir & "exclude.gif"" border=""0"" alt=""" & STR_NON_VIEW & """ " & _
				"width=""16"" height=""16"">" & _
			"</center>"
	else
		select case Field.type
			case else
				if IsNull(Field.value) then
					sValue = "&lt;NULL&gt;"
				else
					sValue = CStr(Field.value)
					if sValue = "" then sValue = "&nbsp;"
				end if
		end select
		sField = sValue
	end if

	InsertFieldValue = sField

End Function


''--------------------------------------------------------------------------
'' Name:     InsertFieldDefinition
''           =====================
'' 
'' Returns HTML code for field definition
''
'' Parameter: 
''		Field			field object
''		bIsPrimaryKey	this is a primary key field
''		sStyle			name of CSS style class
''
'' return value:
''		none
''
''--------------------------------------------------------------------------
Private Function InsertFieldDefinition ( Field, bIsPrimaryKey, sStyle ) 
	Dim sReturn

	sReturn = _
		"<tr>" & vbCrLf & _
		"<td class=""" & sStyle & """>"

	if bIsPrimaryKey then sReturn = sReturn & "<i>"
	sReturn = sReturn & field.name
	if bIsPrimaryKey then sReturn = sReturn & "</i>"
	sReturn = sReturn & "</td>" & vbCrLf & _

		"<td class=""" & sStyle & """>" & GetTypeString(field.type) & "</td>" & vbCrLf & _
		"<td class=""" & sStyle & """>" & CStr(field.definedsize) & "</td>" & vbCrLf & _
		"<td class=""" & sStyle & """>" & CStr(field.precision) & "</td>" & vbCrLf & _
		"<td class=""" & sStyle & """>" & GetAttributesString(field.attributes) & "</td>" & vbCrLf & _
		"</tr>" & vbCrLf

	InsertFieldDefinition = sReturn
End Function


''--------------------------------------------------------------------------
'' Name:     getNavigation
''           =============
'' 
'' Returns HTML code for navigation within table.
''
'' Parameter: 
''		none
''
'' return value:
''		string		HTML code
''
''--------------------------------------------------------------------------
Private Function getNavigation

	Dim sNavPage, sNavStatistic, sNavPageSize

	Dim s, sValue
	Dim i, nTo, nFrom, nColCount

	Dim b10, b25, b50, bAll, bPrev, bNext, bCurrent

	nColCount = UBound(m_PrimaryKeyFields) + UBound(m_StandardFields)
	if not m_bReadOnly then nColCount = nColCount + 1

	b10   = (m_nPageSize <> 10)
	b25   = (m_nPageSize <> 25)
	b50   = (m_nPageSize <> 50)
	bAll  = (m_nPageSize < m_RS.RecordCount)
	bPrev = (m_nPage > 1)
	bNext = (m_nPage < m_RS.PageCount)

	nFrom = 0
	if m_RS.RecordCount > 0 then nFrom = 1 + ((m_nPage - 1) * m_nPageSize)
	nTo   = m_nPageSize + ((m_nPage - 1) * m_nPageSize)
	if nTo > m_RS.RecordCount then
		nTo = m_RS.RecordCount
	end if


	' page navigation
	sNavPage = _
		"<table><tr>" & vbCrLf & _
		"<td class=""ute_navigation"">" & STR_PAGES & "</td>" & vbCrLf & _
		"<td class=""ute_navigation"">" & vbCrLf

	s = Request.QueryString
	if bPrev then
		s = getLink(m_sUTEScript, s, sParamPage, CStr(m_nPage-1))
		sNavPage = sNavPage & "<a href=""" & s & """ title=""" & STR_PREV_PAGE & """ " & _
			"class=""ute_link"">&lt;&lt;</a>&nbsp;" & vbCrLf
	else
		sNavPage = sNavPage & "<span class=""ute_navigation_passive"">&lt;&lt;</span>&nbsp;" & vbCrLf
	end if

	sNavPage = sNavPage & "<select class=""ute_navigation"" name=""pages"" onChange=""jumpPage('parent', this, 0)"">" & vbCrLf 
	for i = 1 to m_RS.PageCount
		bCurrent = (i = m_nPage)
		s = getLink(m_sUTEScript, s, sParamPage, CStr(i))
		if not bCurrent then
			sNavPage = sNavPage & "<option value='" & s & "' >" & i & "</option>" & vbCrLf
		else
			sNavPage = sNavPage & "<option value='" & s & "' selected>" & i & "</option>" & vbCrLf
		end if
	next
	sNavPage = sNavPage & "</select>" & vbCrLf

	if bNext then
		s = getLink(m_sUTEScript, s, sParamPage, CStr(m_nPage+1))
		sNavPage = sNavPage & "<a href=""" & s & """ title=""" & STR_NEXT_PAGE & """ " & _
			"class=""ute_link"">&gt;&gt;</a>" & vbCrLf
	else
		sNavPage = sNavPage & "<span class=""ute_navigation_passive"">&gt;&gt;</span>" & vbCrLf
	end if

	sNavPage = sNavPage & _
		"</td>" & vbCrLf & _
		"</tr></table>" & vbCrLf


	' statistics
	sNavStatistic = Replace(STR_RECORDS,   "%1", CStr(nFrom))
	sNavStatistic = Replace(sNavStatistic, "%2", CStr(nTo))
	sNavStatistic = Replace(sNavStatistic, "%3", CStr(m_RS.RecordCount))


	' page size
	sNavPageSize = _
		"<table><tr>" & vbCrLf & _
		"<td class=""ute_navigation"">" & STR_REC_COUNT & "</td>" & vbCrLf & _
		"<td class=""ute_navigation"">" & vbCrLf

	sNavPageSize = sNavPageSize & "<select class=""ute_navigation"" name=""psize"" onChange=""jumpPage('parent', this, 0)"">" & _
					vbCrLf 

	s = Request.QueryString
	if m_RS.RecordCount > 10 then
		s = getLink(m_sUTEScript, s, sParamPage,     "1")
		s = getLink(m_sUTEScript, s,  sParamPageSize, "10")
		if b10 then
			sNavPageSize = sNavPageSize & "<option value='" & s & "'>10</option>" & vbCrLf
		else
			sNavPageSize = sNavPageSize & "<option value='" & s & "' selected>10</option>" & vbCrLf
		end if
	end if
		
	if m_RS.RecordCount > 25 then
		s = getLink(m_sUTEScript, s, sParamPage,     "1")
		s = getLink(m_sUTEScript, s,  sParamPageSize, "25")
		if b25 then
			sNavPageSize = sNavPageSize & "<option value='" & s & "'>25</option>" & vbCrLf
		else
			sNavPageSize = sNavPageSize & "<option value='" & s & "' selected>25</option>" & vbCrLf
		end if
	end if
		
	if m_RS.RecordCount > 50 then
		s = getLink(m_sUTEScript, s, sParamPage,     "1")
		s = getLink(m_sUTEScript, s,  sParamPageSize, "50")
		if b50 then
			sNavPageSize = sNavPageSize & "<option value='" & s & "'>50</option>" & vbCrLf
		else
			sNavPageSize = sNavPageSize & "<option value='" & s & "' selected>50</option>" & vbCrLf
		end if
	end if

	if m_RS.RecordCount <> 0 then
		s = getLink(m_sUTEScript, s, sParamPage,     "1")
		s = getLink(m_sUTEScript, s,  sParamPageSize, CStr(m_RS.RecordCount))
		if bAll then
			sNavPageSize = sNavPageSize & "<option value='" & s & "'>" & STR_ALL & "</option>" & vbCrLf
		else
			sNavPageSize = sNavPageSize & "<option value='" & s & "' selected>" & STR_ALL & "</option>" & vbCrLf
		end if
	end if

	sNavPageSize = sNavPageSize & "</select>" & vbCrLf

	sNavPageSize = sNavPageSize & _
		"</td>" & vbCrLf & _
		"</tr></table>" & vbCrLf


	sValue = _
		"<tr><td class=""ute_navigation"" colspan=""" & CStr(nColCount) & """>" & vbCrLf & _
		"<table width=""100%""><tr>" & vbCrLf & _
		"<td width=""33%"" class=""ute_navigation"" align=""left"">"   & sNavPage      & "</td>" & vbCrLf & _
		"<td width=""33%"" class=""ute_navigation"" align=""center"">" & sNavStatistic & "</td>" & vbCrLf & _
		"<td width=""33%"" class=""ute_navigation"" align=""right"">"  & sNavPageSize  & "</td>" & vbCrLf & _
		"</tr></table>" & vbCrLf & _
		"</td></tr>"

	getNavigation = sValue

End Function


''--------------------------------------------------------------------------
'' Name:     buildHTML_Table
''           ===============
'' 
'' Creates entire UTE HTML code for table view mode.
''
'' Parameter: 
''		none
''
'' return value:
''		string		HTML code
''
''--------------------------------------------------------------------------
Private Function buildHTML_Table()
	Dim i
	Dim nCounter
	Dim s
	Dim sStyle
	Dim sValue

	' add javascript code
	sValue = _
		"<script language=""JavaScript"">" & vbCrLf & _
		"<!--" & vbCrLf & _
		"	browserName = navigator.appName;" & vbCrLf & _
		"	browserVer = parseInt(navigator.appVersion);" & vbCrLf & _
		vbCrLf & _
		"	if (browserName == ""Netscape"" && browserVer >= 3)" & vbCrLf & _
		"	{" & vbCrLf & _
		"	version = ""n3"";" & vbCrLf & _
		"	}" & vbCrLf & _
		"	else if (browserName == ""Microsoft Internet Explorer"" && browserVer >= 3)" & vbCrLf & _
		"	{" & vbCrLf & _
		"	version = ""n3"";" & vbCrLf & _
		"	}" & vbCrLf & _
		"	else version = ""n2"";" & vbCrLf & _
		vbCrLf & _
		"	if (version == ""n3"")" & vbCrLf & _
		"	{" & vbCrLf & _
		"		// create image objects" & vbCrLf & _
		"		Add_normal        = new Image();" & vbCrLf & _
		"		Add_active        = new Image();" & vbCrLf & _
		"		Edit_normal       = new Image();" & vbCrLf & _
		"		Edit_active       = new Image();" & vbCrLf & _
		"		Delete_normal     = new Image();" & vbCrLf & _
		"		Delete_active     = new Image();" & vbCrLf & _
		vbCrLf & _
		"		// assign actual images to image objects" & vbCrLf & _
		"		Add_normal.src    = """ & m_sIMAGEDir & "btnAdd.gif"";" & vbCrLf & _
		"		Add_active.src    = """ & m_sIMAGEDir & "btnAddSel.gif"";" & vbCrLf & _
		"		Edit_normal.src   = """ & m_sIMAGEDir & "btnEdit.gif"";" & vbCrLf & _
		"		Edit_active.src   = """ & m_sIMAGEDir & "btnEditSel.gif"";" & vbCrLf & _
		"		Delete_normal.src = """ & m_sIMAGEDir & "btnDelete.gif"";" & vbCrLf & _
		"		Delete_active.src = """ & m_sIMAGEDir & "btnDeleteSel.gif"";" & vbCrLf & _
		"	}" & vbCrLf & _
		"" & vbCrLf & _
		"	function SelectImage(img_src, img_name)" & vbCrLf & _
		"	{" & vbCrLf & _
		"		if (version == ""n3"")" & vbCrLf & _
		"		{" & vbCrLf & _
		"			imgOn = eval(img_src + "".src"");" & vbCrLf & _
		"			document [img_name].src = imgOn;" & vbCrLf & _
		"		}" & vbCrLf & _
		"	}" & vbCrLf & _
		"" & vbCrLf & _
		"	function jumpPage(targ, selObj, restore)" & vbCrLf & _
		"	{" & vbCrLf & _
        "		eval(targ + "".location='"" + selObj.options[selObj.selectedIndex].value + ""'"");" & vbCrLf & _
        "		if (restore) selObj.selectedIndex=0;" & vbCrLf & _
		"	}" & vbCrLf & _
		"//-->" & vbCrLf & _
		"</script>" & vbCrLf & _
		vbCrLf & _
		"<p><span class=""ute_headline"">" & m_sHeadline & "</span></p>" & vbCrLf & _
		vbCrLf


	' add naviation bar, first instance
	sValue = sValue & "<table class=""ute_table"">" & vbCrLf
	sValue = sValue & getNavigation & vbCrLf
	sValue = sValue & "</table>" & vbCrLf

	' add table
	sValue = sValue & "<table class=""ute_table"">" & vbCrLf
	sValue = sValue & "<tr>" & vbCrLf

	if not m_bReadOnly then
		' add insert record link
		s = Request.QueryString
		s = getLink(m_sUTEScript, s, sParamMode,     MD_FORM)
		s = getLink(m_sUTEScript, s, sParamFormMode, MD_INSERT)
		sValue = sValue & _
		"<td class=""ute_header"" width=""30"">" & vbCrLf & _
		"<a href=""" & s & """ title=""" & STR_INSERT & """ " & _
			"onMouseover=""SelectImage('Add_active','Add');""" & _
			"onMouseout=""SelectImage('Add_normal','Add');"">" & _
			"<img src=""" & m_sIMAGEDir & "btnAdd.gif"" border=""0"" alt=""" & STR_INSERT & """ " & _
			"name=""Add"" width=""12"" height=""12""></a>" & vbCrLf & _
		"</td>" & vbCrLf
	end if 

	' add primary keys fields to header
	for i = 1 to UBound(m_PrimaryKeyFields)
		sValue = sValue & _
			"<td class=""ute_header_pk"">" & vbCrLf & _
			InsertField (m_RS.fields(m_PrimaryKeyFields(i))) & _
			"</td>" & vbCrLf
	next

	' add standard fields to header
	for i = 1 to UBound(m_StandardFields)
		select case m_RS.fields(m_StandardFields(i)).Type
			' MEMO
			case adLongVarChar, adLongVarWChar
				sValue = sValue & _
					"<td class=""ute_header"" width=""" & CStr(DEF_MEMO_COL_WIDTH) & """>" & vbCrLf & _
					InsertField (m_RS.fields(m_StandardFields(i))) & _
					"</td>" & vbCrLf
			case else
				sValue = sValue & _
					"<td class=""ute_header"">" & vbCrLf & _
					InsertField (m_RS.fields(m_StandardFields(i))) & _
					"</td>" & vbCrLf
		end select
	next

	sValue = sValue & "</tr>" & vbCrLf

	' insert values
	nCounter = 1
	Do Until m_RS.EOF or (nCounter > m_nPageSize)

		sValue = sValue & "<tr>" & vbCrLf

		if not m_bReadOnly then
			' add edit record link
			s = Request.QueryString
			s = getLink(m_sUTEScript, s, sParamMode,     MD_FORM)
			s = getLink(m_sUTEScript, s, sParamFormMode, MD_EDIT)
			s = getLink(m_sUTEScript, s, sParamRecord,   CStr(nCounter + ((m_nPage - 1) * m_nPageSize)))
			sValue = sValue & _
				"<td class=""ute_header"" width=""30"">" & vbCrLf & _
				"<a href=""" & s & """ title=""" & STR_EDIT & """ " & _
					"onMouseover=""SelectImage('Edit_active','Edit" & CStr(nCounter)& "');""" & _
					"onMouseout=""SelectImage('Edit_normal','Edit" & CStr(nCounter)& "');"">" & _
					"<img src=""" & m_sIMAGEDir & "btnEdit.gif"" border=""0"" alt=""" & STR_EDIT & """ " & _
					"name=""Edit" & CStr(nCounter)& """ width=""12"" height=""12""></a>" & vbCrLf
			' add delete record link
			s = Request.QueryString
			s = getLink(m_sUTEScript, s, sParamMode,     MD_FORM)
			s = getLink(m_sUTEScript, s, sParamFormMode, MD_DELETE)
			s = getLink(m_sUTEScript, s, sParamRecord,   CStr(nCounter + ((m_nPage - 1) * m_nPageSize)))
			sValue = sValue & _
				"<a href=""" & s & """ title=""" & STR_DELETE & """ " & _
					"onMouseover=""SelectImage('Delete_active','Delete" & CStr(nCounter)& "');""" & _
					"onMouseout=""SelectImage('Delete_normal','Delete" & CStr(nCounter)& "');"">" & _
					"<img src=""" & m_sIMAGEDir & "btnDelete.gif"" border=""0"" alt=""" & STR_DELETE & """ " & _
					"name=""Delete" & CStr(nCounter)& """ width=""12"" height=""12""></a>" & vbCrLf & _
				"</td>" & vbCrLf
		end if

		if (nCounter mod 2) = 0 then
			sStyle = "ute_content_even"
		else
			sStyle = "ute_content_odd"
		end if

		' add primary keys field value
		for i = 1 to UBound(m_PrimaryKeyFields)
			sValue = sValue & _
				"<td class=""" & sStyle & "_pk"">" & _
				InsertFieldValue (m_RS.fields(m_PrimaryKeyFields(i))) & _
				"</td>" & vbCrLf
		next

		' add standard field value
		for i = 1 to UBound(m_StandardFields)
			select case m_RS.fields(m_StandardFields(i)).Type
				' MEMO
				case adLongVarChar, adLongVarWChar
					sValue = sValue & _
						"<td class=""" & sStyle & """ width=""" & CStr(DEF_MEMO_COL_WIDTH) & """>" & _
						InsertFieldValue (m_RS.fields(m_StandardFields(i))) & _
						"</td>" & vbCrLf
				case else
					sValue = sValue & _
						"<td class=""" & sStyle & """>" & _
						InsertFieldValue (m_RS.fields(m_StandardFields(i))) & _
						"</td>" & vbCrLf
			end select
		next

		sValue = sValue & "</tr>" & vbCrLf

		nCounter = nCounter + 1
		m_RS.MoveNext
	Loop

	sValue = sValue & "</table>" & vbCrLf

	' add naviation bar, second instance
	sValue = sValue & "<table class=""ute_table"">" & vbCrLf
	sValue = sValue & getNavigation & vbCrLf
	sValue = sValue & "</table>" & vbCrLf


	' add "Powered By"
	sValue = sValue & getPoweredBy & vbCrLf

	' add additional links
	if (m_bListTables) or (m_bShowExportLink) or (m_bShowDefLink) then
		sValue = sValue & "<table>" & vbCrLf

		' list all tables within database
		if m_bListTables then
			s = Request.QueryString
			s = getLink(m_sUTEScript, s, sParamTable,    "")
			s = getLink(m_sUTEScript, s, sParamMode,     MD_DATABASE)
			s = getLink(m_sUTEScript, s, sParamPage,     DEF_PAGE)
			s = getLink(m_sUTEScript, s, sParamPageSize, DEF_PAGE_SIZE)
			s = getLink(m_sUTEScript, s, sParamDefs,     "0")
			s = RemoveCountedParameters(s, sParamSort, 1)
			s = RemoveCountedParameters(s, sParamSortDir, 1)
			sValue = sValue & _
				"<tr>" & vbCrLf & _
				"<td><a href=""" & s & """><img src=""" & m_sIMAGEDir & "database.gif"" border=""0"" " & _
					"height=""16"" width=""16"" title=""" & STR_LIST_TABLES & """></a></td>" & vbCrLf & _
				"<td class=""ute_outer_text"">" & STR_LIST_TABLES & "</td>" & vbCrLf & _
				"</tr>" & vbCrLf
		end if

		' export data link
		if m_bShowExportLink then
			s = Request.QueryString
			s = getLink(m_sUTEScript, s, sParamMode, MD_EXPORT)
			sValue = sValue & _
				"<tr>" & vbCrLf & _
				"<td><a href=""" & s & """><img src=""" & m_sIMAGEDir & "down.gif"" border=""0"" " & _
					"height=""16"" width=""16"" title=""" & STR_EXPORT & """></a></td>" & vbCrLf & _
				"<td class=""ute_outer_text"">" & STR_EXPORT & "</td>" & vbCrLf & _
				"</tr>" & vbCrLf
		end if

		' show/hide field definitions
		if (m_bShowDefLink) and (m_RS.RecordCount > 0) then
			if m_bViewDefinitions then
				s = Request.QueryString
				s = getLink(m_sUTEScript, s, sParamDefs, "0")
				sValue = sValue & _
					"<tr>" & vbCrLf & _
					"<td><a href=""" & s & """><img src=""" & m_sIMAGEDir & "definition.gif"" border=""0"" " & _
						"height=""16"" width=""16"" title=""" & STR_DEF_HIDE & """></a></td>" & vbCrLf & _
					"<td class=""ute_outer_text"">" & STR_DEF_HIDE & "</td>" & vbCrLf & _
					"</tr>" & vbCrLf
			else
				s = Request.QueryString
				s = getLink(m_sUTEScript, s, sParamDefs, "1")
				sValue = sValue & _
					"<tr>" & vbCrLf & _
					"<td><a href=""" & s & """><img src=""" & m_sIMAGEDir & "definition.gif"" border=""0"" " & _
						"height=""16"" width=""16"" title=""" & STR_DEF_SHOW & """></a></td>" & vbCrLf & _
					"<td class=""ute_outer_text"">" & STR_DEF_SHOW & "</td>" & vbCrLf & _
					"</tr>" & vbCrLf
			end if
		end if

		sValue = sValue & "</table>"
	end if

	' show field definitions if link is enabled and selected
	if (m_bShowDefLink) and (m_bViewDefinitions) and (m_RS.RecordCount > 0) then

		sValue = sValue & _
			"<p><table class=""ute_table"">" & vbCrLf & _
			"<tr>" & vbCrLf & _
			"<td class=""ute_header"">" & STR_DEF_NAME & "</td>" & vbCrLf & _
			"<td class=""ute_header"">" & STR_DEF_TYPE & "</td>" & vbCrLf & _
			"<td class=""ute_header"">" & STR_DEF_DEFINEDSIZE & "</td>" & vbCrLf & _
			"<td class=""ute_header"">" & STR_DEF_PRECISION & "</td>" & vbCrLf & _
			"<td class=""ute_header"">" & STR_DEF_ATTRIBUTES & "</td>" & vbCrLf & _
			"</tr>" & vbCrLf

		m_RS.MoveFirst
		nCounter = 0

		if UBound(m_PrimaryKeyFields) > 0 then
			for i = 1 to UBound(m_PrimaryKeyFields)
				nCounter = nCounter + 1
				if (nCounter mod 2) = 0 then
					sStyle = "ute_content_even"
				else
					sStyle = "ute_content_odd"
				end if
				sValue = sValue & InsertFieldDefinition (m_RS.fields(m_PrimaryKeyFields(i)), True, sStyle)
			next
		end if

		if UBound(m_StandardFields) > 0 then
			for i = 1 to UBound(m_StandardFields)
				nCounter = nCounter + 1
				if (nCounter mod 2) = 0 then
					sStyle = "ute_content_even"
				else
					sStyle = "ute_content_odd"
				end if
				sValue = sValue & InsertFieldDefinition (m_RS.fields(m_StandardFields(i)), False, sStyle)
			next
		end if

		sValue = sValue & "</table></p>"

	end if

	buildHTML_Table = sValue

End Function

%>

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
CEO Student
Germany Germany
Tom is in software development for about 15 years. He started with a SHARP MZ80k in Basic and Assembly Language. After collecting some experiance on an ATARI 1040ST he bought his very first IBM XT 286 (incl. 287!) and started to program in Turbo Pascal. He became very familiar with Borland's Turbo Vision and over the last years did a lot of development in C++ (MFC), Visual Basic, VB Script, ASP and SQL. He currently works as senior consultant for Swyx Solutions GmbH, based in Dortmund, Germany.
His absolute favourite is Guinness Wink | ;-) Sláinte!

Comments and Discussions