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

	sub ShowForm
%>
	<!--#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> 创建表格
			</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>
	
	<br>
	<p class="smallerheader">
		输入表格名（请点击创建按钮）<br><br><%=sErr%>
	</p>
	<form action="te_tablecreate.asp?cid=<%=lConnID%>" method="post">
	<table border=0>
		<tr>
			<td class="smallerheader">表格名</td>
			<td><input type="text" name="txtTableName" class="tbflat"></td>
		</tr>
		<tr>
			<td></td>
			<td><input type="submit" name="cmdCreate" value=" 创建 " class="cmdflat"></td>
		</tr>
	</table>
	</form>
	<!--#include file="te_footer.asp"-->
	<%
	end sub

	lConnID = request("cid")
	sTableName = request("txtTableName")
	
	on error resume next
	if request("cmdCreate") <> "" then
	
		OpenRS arrConn(lConnID)
		
		if sTableName = "" then
			sErr = "出错了: <br>请指定一个表格名."
			ShowForm
			response.end
		end if
		
		sSQL = "CREATE TABLE [" & sTableName & "]"
		conn.execute sSQL
		if err <> 0 then
			sErr = "错误 : <br>" & err.description
			bErr = True

			conn.close
			set conn=nothing
			set rs=nothing

			ShowForm
		else
			conn.close
			set conn=nothing
			set rs=nothing

			response.redirect "te_fieldedit.asp?cid=" & lConnID & "&tablename=" & sTableName
		end if
	
	else
		ShowForm
	end if
	

%>
 

