<%

%>
<!--#include file="te_config.asp"-->
<!--#include file="te_header.asp"-->

<table border=0 cellspacing=1 cellpadding=2 bgcolor = "#ffe4b5" width=100%>
	<tr>
		<td class="smallertext">
			<a href="index.asp">管理首页</a> <a href="te_admin.asp">编辑页面</a> <a href="te_listtables.asp?cid=<%=request("cid")%>"><%=arrDesc(request("cid"))%></a> 表格信息 [<%=request("tablename")%>]
		</td>
		<td class="smallerheader" width=130 align=right>
		<%
		if bProtected then 
			response.write session("teFullName")
			response.write "<a href=""te_logout.asp""> (退出)</a>" 
		end if
		%>
		</td>
	</tr>
</table>

<%
	lConnID = request("cid")
	sTableName = request("tablename")
	sType = request("type")
	
	OpenRS arrConn(lConnID)
	
	if sType = "query" then
		set adox = server.createobject("adox.catalog")
		adox.activeconnection = conn
		response.write "<br>Query : <br>" 
		response.write "<textarea cols=120 rows=5 class=""tbflat"">" & adox.views(sTableName).command.commandtext & "</textarea><br>"
	end if

%>
<br>
<table border=0 cellspacing=1 cellpadding=2 bgcolor = "#ffdead" width=100%>
	<tr>
		<td width=10></td>
		<td class="smallerheader" colspan=4>区域定义</td>
	</tr>
	<tr bgcolor="#fffaf0">
		<td width=10></td>
		<td class="smallerheader">区域名称</td>
		<td class="smallerheader">区域类型</td>
		<td class="smallerheader">大小</td>
		<td class="smallerheader">属性</td>
		<td width=10></td>
	</tr>
<%

	rs.Open "[" & sTableName & "]", , ,adCmdTable
	
	for each fld in rs.fields
		sAttributes = ""
		sFieldType = ""
		select case fld.Type
			case adSmallInt			: sFieldType = "integer"
			case adInteger			: sFieldType = "long"
			case adBoolean			: sFieldType = "boolean"
			case adDate				: sFieldType = "date"
			case adCurrency			: sFieldType = "currency"
			case adVarWChar			: sFieldType = "text"
			case adLongVarWChar		: sFieldType = "memo"
			case adLongVarBinary	: sFieldType = "ole"
			case adGUID				: sFieldType = "guid"
			case adUnsignedTinyInt	: sFieldType = "byte"
			case else				: sFieldType = fld.type
		end select
		
		if fld.properties("isAutoIncrement") = true then
			sAttributes = sAttributes & "(auto increment)"
		end if

		if (fld.attributes and adFldKeyColumn) = adFldKeyColumn then
			sAttributes = sAttributes & " (primary key)"
		end if

		if (fld.attributes and adFldUpdatable) = adFldUpdatable then
			sAttributes = sAttributes & " (updatable)"
		end if
		
		if (fld.attributes and adFldIsNullable) = adFldIsNullable then
			sAttributes = sAttributes & " (nullable)"
		end if

		if (fld.attributes and adFldFixed) = adFldFixed then
			sAttributes = sAttributes & " (fixed)"
		end if

		if (fld.attributes and adFldLong) = adFldLong then
			sAttributes = sAttributes & " (long)"
		end if

		if (fld.attributes and adFldRowID) = adFldRowID then
			sAttributes = sAttributes & " (row id)"
		end if

		if (fld.attributes and adFldIsRowURL) = adFldIsRowURL then
			sAttributes = sAttributes & " (url)"
		end if
		
		
		%>
		<tr bgcolor="#fffaf0">
			<td width=10></td>
			<td class="smallertext"><%=fld.name%></td>	
			<td class="smallertext"><%=sFieldType%></td>
			<td class="smallertext"><%=fld.definedsize%></td>	
			<td class="smallertext"><%=sAttributes%></td>
			<td width=10></td>
		</tr>
		<%
	next
	
	response.write "</table><br>"
	
	CloseRS
	
%>
	
<!--#include file="te_footer.asp"-->
 

