<%guidedisplay=1%>
<!--#include file="admin_start.asp" -->
<%
Session("FB_EM_1_ACC_c")=request.form("c")

dim table

table=request("table")
field_get=request("field_get")

function getfield(t)

	
	dim rsSchema
	't=table
	
	if t="" then exit function

	set rsSchema=Conn.openSchema(4)
	rsSchema.Filter =  "TABLE_NAME='" & t & "' "
	do while not rsSchema.eof 
			if rsSchema("DESCRIPTION")<>"" then 
			response.write "<option value='"&rsSchema("COLUMN_NAME")&"'>"&rsSchema("COLUMN_NAME")&" ["&rsSchema("DESCRIPTION")&"]</option>"
			else
			response.write "<option value='"&rsSchema("COLUMN_NAME")&"'>"&rsSchema("COLUMN_NAME")&"</option>"
			end if
		rsSchema.movenext
	loop
	set rsSchema=nothing

end function

%>
<form name='makesql' method="post"  target='_self'>
   <select name="field_get" id=field <%if request("type")=0 then %> multiple size=10 <%end if%>  style='width:300px; border:1px solid #f7f7f7' onchange='<%if request("type")=0 then %>changefield_m(field)<%else %>changefield()<%end if%>'>
   <%if request("type")=0 then %>
   <option value="" selected >所有字段(按Ctrl键多选)</option>
    <%else%>
   <option value="" selected >请选择字段</option>
  <%end if%>
   <%getfield(table)%>
   </select> 
</form>
<script language="javascript" >

	function changefield(){
	parent.document.makesql.<%=field_get%>.value=document.makesql.field_get.value;
	}
	function changefield_m(obj){
	var ops=obj.options,str="";
	for(i=0;i<ops.length;i++)
	if(ops[i].selected && ops[i].value!='')str+=ops[i].value+", "
	parent.document.makesql.<%=field_get%>.value=str.substr(0,str.length-2);
	}

	<%if request("type")=0 then %>
	//changefield_m(field);
	<%else %>
	changefield();
	<%end if %>
	
</script>

</body>
<!--#include file="admin_end.asp" -->