Arpan wrote on 08 sep 2005 in microsoft.public.inetserver.asp.general:
That's exactly what I did but if I am not wrong, the resulting
2-dimensional array will contain the NUMBER of columns in the table (&
not the NAMES of the columns) & the number of records in the table,
isn't it?
Don't know about SQL-server, I use Microsoft.Jet.OLEDB.4.0.
I use this:
<%@Language=VBScript%>
<!-- #include file ="openDbaseAfterPasswordProtection.asp"-->
<body style='background-color:navy;padding:50px;'>
<div style='padding:30px;background-color:white;font-
size:14pt;width:350px;'>
<%
dim columnTypes(205)
columnTypes(0) = "Empty"
columnTypes(2) = "SmallInt"
columnTypes(3) = "Integer"
columnTypes(4) = "Real"
columnTypes(5) = "Double"
columnTypes(6) = "Currency"
columnTypes(7) = "Date"
columnTypes(8) = "BSTR"
columnTypes(9) = "IDispatch"
columnTypes(10) = "Error Code"
columnTypes(11) = "Boolean"
columnTypes(12) = "Variant"
columnTypes(13) = "IUnknown"
columnTypes(14) = "Decimal"
columnTypes(16) = "TinyInt"
columnTypes(17) = "Unsigned TinyInt (BYTE)"
columnTypes(18) = "Unsigned Small Int (WORD)"
columnTypes(19) = "Unsigned Int (DWORD)"
columnTypes(20) = "BigInt"
columnTypes(21) = "Unsigned Big Int"
columnTypes(64) = "FileTime"
columnTypes(72) = "Unique Identifier (GUID)"
columnTypes(128) = "Binary"
columnTypes(129) = "Char"
columnTypes(130) = "nChar"
columnTypes(131) = "Numeric"
columnTypes(132) = "User Defined (UDT)"
columnTypes(133) = "DBDate"
columnTypes(134) = "DBTime"
columnTypes(135) = "SmallDateTime"
columnTypes(136) = "Chapter"
columnTypes(138) = "Automation (PropVariant)"
columnTypes(139) = "VarNumeric"
columnTypes(200) = "VarChar"
columnTypes(201) = "Text"
columnTypes(202) = "nVarChar"
columnTypes(203) = "nText"
columnTypes(204) = "VarBinary"
columnTypes(205) = "Image"
function tables(tablename)
Response.Write "<hr><hr>"&tablename&"<hr>"
set rs = CONNECT.Execute("select * from " & tablename)
for each column in rs.fields
Response.Write column.name & " [" & columnTypes(column.type)
ct = column.type
if ct = 129 or ct = 130 or ct = 200 or ct = 202 then
' definedSize only works in SQL Server
Response.write " (" & column.definedSize & ")"
end if
Response.Write "]"
if column.Properties("IsAutoIncrement") then
response.write " (AutoNumber)"
end if
Response.Write "<br>"
next
rs.close: set rs = nothing
end function
tables("tblNumber1") ' name your tables
tables("tblNumber2")
' etc.
CONNECT.close: set CONNECT = nothing
%>
</div>
I forgot where the souce was from.