<% '============================================================== ' TableEditoR 0.81 Beta ' http://www.2enetworx.com/dev/projects/tableeditor.asp '-------------------------------------------------------------- ' File: te_fieldremove.asp ' Description: Removes a field from the table ' Initiated By Hakan Eskici on Nov 17, 2000 '-------------------------------------------------------------- ' Copyright (c) 2002, 2eNetWorX/dev. ' ' TableEditoR is distributed with General Public License. ' Any derivatives of this software must remain OpenSource and ' must be distributed at no charge. ' (See license.txt for additional information) ' ' See Credits.txt for the list of contributors. ' ' Change Log: '-------------------------------------------------------------- '============================================================== %> <% lConnID = request("cid") sTableName = request("tablename") sFieldName = request("fldname") OpenRS arrConn(lConnID) 'Check if the user approved delete and has permissions to delete if (request("sure") <> "") and bFldDel then 'Delete the indexes if any set rs = conn.openSchema(adSchemaIndexes) do while not rs.eof if rs("table_name") = sTableName then if (rs("column_name") = sFieldName) then sSQL = "ALTER TABLE [" & sTableName & "] DROP CONSTRAINT [" & rs("index_name") & "]" conn.execute sSQL end if end if rs.movenext loop sSQL = "ALTER TABLE [" & sTableName & "] DROP COLUMN [" & sFieldName & "]" conn.execute sSQL response.redirect "te_tableedit.asp?cid=" & lConnID & "&tablename=" & sTableName end if 'Check if the field is indexed set rs = conn.openSchema(adSchemaIndexes) do while not rs.eof if rs("table_name") = sTableName then if (rs("column_name") = sFieldName) then sErr = "Field '" & sFieldName & "' is indexed. If you delete this field, all related indices will also be deleted.

" end if end if rs.movenext loop CloseRS %>
Home » Connections » "><%=arrDesc(request("cid"))%> » &tablename=<%=server.urlencode(request("tablename"))%>">Edit Table [<%=request("tablename")%>] » Remove Field <% if bProtected then response.write session("teFullName") response.write " (logout)" end if %>
<% if bFldDel then %>

<%=sErr%>Are you sure that you want to delete the record?

Yes  ">No <% else %>

You have no permission to delete fields.

<% end if %>