Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Table Documentation
Message
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
Table Documentation
Miscellaneous
Thread ID:
00734532
Message ID:
00734532
Views:
45
I had a need to get the details of tables in a database, and I wrote this piece of code to do it. It creates an HTML string (table) of the table fields. Thought it might be of use to others...
lcTableName = "VENDOR"
lcNewTableName = "VENDOR"

USE (lcTableName )
lcFontNormal = '<font face=arial>'
lcFontSmallStart = '<font face=arial size=1>'
lcFontEnd = '</font>'

lnFields = AFIELDS(lafields)
lcHTML = '<font face=arial><b>'+lcNewTableName+'</b><br>'+CHR(13)
lcHTML = lcHTML + '<table border = 1>'+CHR(13)
lcHTML = lcHTML + '<tr>'+CHR(13)
lcHTML = lcHTML + '<td bgcolor=silver>' + lcFontSmallStart + 'Field Name' + lcFontEnd + '</td>'+CHR(13)
lcHTML = lcHTML + '<td bgcolor=silver>' + lcFontSmallStart + 'Type' + lcFontEnd + '</td>'+CHR(13)
lcHTML = lcHTML + '<td bgcolor=silver>' + lcFontSmallStart + 'Width' + lcFontEnd + '</td>'+CHR(13)
lcHTML = lcHTML + '<td bgcolor=silver>' + lcFontSmallStart + 'Decimals' + lcFontEnd + '</td>'+CHR(13)
lcHTML = lcHTML + '<td bgcolor=silver>' + lcFontSmallStart + 'Description' + lcFontEnd + '</td>'+CHR(13)
lcHTML = lcHTML + '</tr>'+CHR(13)

FOR i = 1 TO lnFields
	lcHTML = lcHTML + '<tr>'+CHR(13)
	lcHTML = lcHTML + '<td>' + lcFontSmallStart + ALLTRIM(lafields(i,1)) + lcFontEnd + '</td>'+CHR(13)
	lcHTML = lcHTML + '<td>' + lcFontSmallStart + ALLTRIM(lafields(i,2)) + lcFontEnd + '</td>'+CHR(13)
	lcHTML = lcHTML + '<td>' + lcFontSmallStart + ALLTRIM(TRANSFORM(lafields(i,3))) + lcFontEnd + '</td>'+CHR(13)
	lcHTML = lcHTML + '<td>' + lcFontSmallStart + ALLTRIM(TRANSFORM(lafields(i,4))) + lcFontEnd + '</td>'+CHR(13)
	lcHTML = lcHTML + '<td>' + lcFontSmallStart + 'I want a long Description Text field in the result table' + lcFontEnd + '</td>'+CHR(13)	
	lcHTML = lcHTML + '</tr>'+CHR(13)

NEXT 

lcHTML = lcHTML + '</table></font>'+CHR(13)

_cliptext=lcHTML
Wayne Myers, MCSD
Senior Consultant
Forte' Incorporated
"The only things you can take to heaven are those which you give away" Author Unknown
Next
Reply
Map
View

Click here to load this message in the networking platform