<!--#include file="../inc/config.asp"-->
<!--#include file="../inc/conn.asp"-->
<!-- #include file="inc/Session.asp" -->
<!-- #include file="inc/checkrole.asp" -->
<%
'''''''''''''''''''''''''''''''''''''''''''''''
call checkPrevilege(Session("Name"),"p10")
'''''''''''''''''''''''''''''''''''''''''''''''
dim i,tablename
tablename=trim(request.QueryString("tablename"))
if(len(tablename)<1) then
 response.Write("请指定正确的表名")
 response.End()
end if
%>
<html>
<head>
<title>数据库在线管理</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<style type="text/css">
<!--
body {
	margin-left: 0px;
	margin-top: 0px;
	margin-right: 0px;
	margin-bottom: 0px;
	background-color: #D4D0C8;
}
.style1 {	color: #FFFFFF;
	font-weight: bold;
}
ul{ margin:0; text-align:left; list-style:none;}
li{ margin:0 5px 0 5px; float:left; list-style:none; list-style-type:none; padding:0;}
.tb{ float:left; margin:0; padding:0; text-align:center; width:80px;}
.tab{ widows:20px; margin:0; padding:0; float:left;}
-->
</style>
<link href="style/global.css" rel="stylesheet" type="text/css">
<script language="JavaScript" type="text/JavaScript">

function ConfirmDel()
{
   if(confirm("确认删除?并且不能恢复！确定要删除这个字段？"))
     return true;
   else
     return false;
	 
}
</script>
</head>
<body>
<table width="100%"  border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td><iframe src="right_top.htm" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" height="30" width="100%"></iframe></td>
  </tr>
</table>

<table width="100%"  border="0" cellpadding="0" cellspacing="1" bgcolor="#333333">
  <tr>
    <td height="22" bgcolor="#FF9900"><div align="center"><span class="style1">◆ <%=tablename%>表： ◆</span></div></td>
  </tr>
  <tr>
    <td bgcolor="#FFFFFF" style="padding:10px; ">
      <br>
<%
'conn.execute("alter table recommen MODIFY(newsid long)")修改字段
dim dimss,forms,rss,fss,gss,coss,cos2,cos3
dimms="dim "
set rs=server.createobject("adodb.recordset")
rs.open "select top 1 * from "&tablename,conn,3,1
response.Write("字段总数："&rs.fields.count&"<br><br>")
response.Write("<table width=""100%""  border=""0"" cellspacing=""1"" cellpadding=""0"" bgcolor=""#D4D0C8"">")&chr(10)
response.Write("<tr>")&chr(10)
response.Write("    <td height=""22""><div align=""center"">字段名称</div></td>")&chr(10)
response.Write("    <td style=""border-left:1px solid #eeeeee;"">字段属性</td>")&chr(10)
response.Write("    <td style=""border-left:1px solid #eeeeee;"" height=""22""><div align=""center"">修 改</div></td>")&chr(10)
response.Write("    <td style=""border-left:1px solid #eeeeee;"" height=""22""><div align=""center"">删 除</div></td>")&chr(10)
 response.Write(" </tr>")&chr(10)
for i=0 to rs.fields.count-1
	dimms=dimms&rs(i).name&","
	forms=forms&rs(i).name&"=request.Form("""&rs(i).name&""")"&chr(13)
	rss=rss&"rs("""&rs(i).name&""")="&rs(i).name&chr(13)
	fss=fss&rs(i).name&"=rs("""&rs(i).name&""")"&chr(13)
	cos2=cos2&""&rs(i).name&"=RemoveHTML(GetBody(s_html,"&rs(i).name&"1,"&rs(i).name&"2,false,false))"&chr(13)
	cos3=cos3&"response.Write("""&rs(i).name&"：""&amp;"&rs(i).name&"&""<br>"")"&chr(13)
	coss=coss&"&lt;TR bgcolor=""#F5F5F5""&gt;"&chr(13)
  coss=coss&"&lt;TD&gt;&lt;div align=""right""&gt;"&rs(i).name&"：&lt;/div&gt;&lt;/TD&gt;"&chr(13)
  coss=coss&"&lt;TD&gt;&lt;textarea name="""&rs(i).name&"1"" cols=""55"" id="""&rs(i).name&"1""&gt;&lt;%=rs("""&rs(i).name&"1"")%&gt;&lt;/textarea&gt;"&chr(13)
  coss=coss&"  &lt;textarea name="""&rs(i).name&"2"" cols=""55"" id="""&rs(i).name&"2""&gt;&lt;%=rs("""&rs(i).name&"2"")%&gt;&lt;/textarea&gt;&lt;/TD&gt;"&chr(13)
  coss=coss&"&lt;/TR&gt;"&chr(13)
	response.Write("<tr bgcolor=""#FFFFFF"">")
	response.Write("<td height=""22""><div align=""center"">"&rs(i).name&"</div></td>")
	response.write "<td>"
	if rs.fields(i).type="3" then
		response.write "长整型"
	if rs.fields(i).Attributes="16" then response.write " 自动编号字段"

	elseif rs.fields(i).type="202" then
		response.write "文本:"
		response.write "长度"&rs.fields(i).DefinedSize 
	elseif rs.fields(i).type="200" then
		response.write "文本:"
		response.write "长度"&rs.fields(i).DefinedSize 
	elseif rs.fields(i).type="2" then
	response.write "整形"

	elseif rs.fields(i).type="11" then
		response.write "是/否"

	elseif rs.fields(i).type="135" then
		response.write "日期/日间"

	elseif rs.fields(i).type="201" then
		response.write "备注"
	elseif rs.fields(i).type="203" then
		response.write "备注"

	elseif rs.fields(i).type="6" then
		response.write "货币"

	elseif rs.fields(i).type="205" then
		response.write "OLE 对象"

	else
		response.write "未知"&rs.fields(i).type
end if
'response.Write(rs.fields(i).ActualSize)
response.write("</td>")&chr(10)
response.Write("    <td height=""22""><div align=""center""><a href=""#"" onClick=""document.form_mod.fieldname.value='"&rs.fields(i).name&"'"">修 改</a></div></td>")&chr(10)
response.Write("    <td height=""22""><div align=""center""><a href=""field.asp?act=dele&fieldname="&rs.fields(i).name&"&tablename="&tablename&""" onClick=""return ConfirmDel()"">删 除</a></div></td>")&chr(10)
response.Write("</tr>")
next
response.Write("</table>")
rs.close
set rs=nothing
dimms=dimms&chr(13)
%>
<!--修改字段---------------------------------------------------->
<br>
<textarea cols="80" rows="9">
<%=dimms%>
<%=forms%>
<%=rss%>
<%=fss%>
</textarea>
<textarea cols="80" rows="10">
<%=cos2%>
<%=cos3%>
<%=coss%>
</textarea>
<fieldset>
<legend>修改字段</legend>
<script language="javascript">
function seleChan1(str){	
	if(str=="varchar"){	
		document.getElementById("fieldsize").style.display="";
	}
	else{
		document.getElementById("fieldsize").style.display="none";
	}
}
</script>
<table width="100%"  border="0" cellpadding="0" cellspacing="0" bgcolor="#D4D0C8">
  <tr>
    <td height="30" bgcolor="#FFFFFF">
      <form name="form_mod" method="post" action="field.asp?act=mod&tablename=<%=tablename%>" style="margin:0; padding:0; "><div align="center">字段名称：
          <input name="fieldname" type="text" size="20" maxlength="25">
          <select name="fieldtype" onChange="seleChan1(this.options[this.selectedIndex].value)">
            <option value="int">长整型</option>
			<option value="smallint">整型</option>
			<option value="varchar">文本</option>
			<option value="datetime">日期/日间</option>
			<option value="text">备注</option>
			<option value="money">货币</option>
			<option value="bit">是/否</option>
          </select>
		  <div id="fieldsize" style="display:none; float:inherit;">长度：<input name="varchar_len" type="text" id="varchar_len" size="10"></div>		  
          <input type="submit" name="Submit" value="修 改">
      </div>
      </form>    </td>
  </tr>
</table>
</fieldset>
<!--添加字段---------------------------------------------------->
<br>
<fieldset>
<legend>添加新字段</legend>
<script language="javascript">
function seleChan(str){	
	if(str=="varchar"){	
		document.getElementById("charlen").style.display="";
	}
	else{
		document.getElementById("charlen").style.display="none";
	}
}
</script>
<table width="100%"  border="0" cellpadding="0" cellspacing="0" bgcolor="#D4D0C8">
  <tr>
    <td height="30" bgcolor="#FFFFFF">
      <form name="form1" method="post" action="field.asp?act=add&tablename=<%=tablename%>" style="margin:0; padding:0; "><div align="center">字段名称：
          <input name="fieldname" type="text" size="20" maxlength="25">
          <select name="fieldtype" onChange="seleChan(this.options[this.selectedIndex].value)">
            <option value="int">长整型</option>
			<option value="smallint">整型</option>
			<option value="varchar" >文本</option>
			<option value="datetime">日期/日间</option>
			<option value="text">备注</option>
			<option value="money">货币</option>
			<option value="bit">是/否</option>
          </select>
		  <div id="charlen" style="display:none; float:inherit;">长度：<input name="varchar_len" type="text" id="varchar_len" size="10"></div>
          <input type="submit" name="Submit" value="添 加">
      </div>
      </form>    </td>
  </tr>
</table>
</fieldset>
<!--执行SQL语句---------------------------------------------------->
<br>
<fieldset>
<legend>执行SQL语句</legend>
<table width="100%"  border="0" cellpadding="0" cellspacing="0" bgcolor="#D4D0C8">
  <tr>
    <td height="30" bgcolor="#FFFFFF">
      <form name="form1" method="post" action="field.asp?act=exe" style="margin:0; padding:0; "><div align="center">sql语句：
          <textarea name="sqlexe" cols="40" rows="4" id="sqlexe">在此处输入sql语句，注：请慎用此功能!</textarea>          
          <input type="submit" name="Submit" value="执 行" onClick="return confirm('确认执行?')">
      </div>
      </form>    </td>
  </tr>
</table>
</fieldset>
</td>
  </tr>
</table>
</body>
</html>
<%
call connclose()
%>