<% '============================================================== ' TableEditoR 0.81 Beta ' http://www.2enetworx.com/dev/projects/tableeditor.asp '-------------------------------------------------------------- ' File: te_tableedit.asp ' Description: Displays the table structure for modification ' Initiated By Hakan Eskici on Nov 15, 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: '-------------------------------------------------------------- '============================================================== %>
Home » Connections » "><%=arrDesc(request("cid"))%> » Edit Table [<%=request("tablename")%>] <% if bProtected then response.write session("teFullName") response.write " (logout)" end if %>

<% lConnID = request("cid") sTableName = request("tablename") OpenRS arrConn(lConnID) if arrType(lConnID) = tedbDsn then response.write "Table Structure modification might not work as expected with Dsn connections.

" end if %> > <% on error resume next rs.Open "[" & sTableName & "]",,,adCmdTable if rs.fields.count = 0 then response.write "No fields defined for table." CloseRS %><% response.end end if if err <> 0 then response.write err.number & ":" & err.description & "

" end if for each fld in rs.fields sFieldType = "" sAttributes = "" 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" ' begin added for SQL2000 2001-04-20 15:46 case adBigInt : sFieldType = "bigint" case adBinary : sFieldType = "binary" case adNumeric : sFieldType = "decimal" case adVarChar : sFieldType = "varchar" case adDouble : sFieldType = "double" case adWChar : sFieldType = "nchar" case adVariant : sFieldType = "variant" case adVarBinary : sFieldType = "varbinary" case adChar : sFieldType = "char" case adDBTimeStamp : sFieldType = "datetime" case adLongVarChar : sFieldType = "text (long)" case adSingle : sFieldType = "single" ' end added for SQL2000 2001-04-20 15:46 case else : sFieldType = fld.type end select isAutoIncrement4DSN = "" if fld.properties("IsAutoIncrement") = true then sAttributes = sAttributes & "(auto increment)" if arrType(lConnID) <> tedbAccess then isAutoIncrement4DSN = "&autoinc=1" end if 'Actually this won't work, any recommendations are welcome 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 adFldMayBeNull) = adFldMayBeNull then ' sAttributes = sAttributes & " (may be null)" '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 ' sAttributes = sAttributes & " (" & fld.attributes & ")" %> <% next response.write "
Field Definitions <% if bFldAdd and bTableEdit then %>     (Add a new field) <% end if %>
Field Name Field Type Size Attributes Action
<%=fld.name%> <%=sFieldType%> <%=fld.definedsize%> <%=sAttributes%> <% if bFldEdit and bTableEdit then %> edit  <% end if if bFldDel and bTableEdit then %> remove <% end if %>

" rs.close 'List Indexes of this table set rs = conn.openSchema(adSchemaIndexes) %> > <% if arrType(lConnID) = tedbDsn then response.write "" end if do while not rs.eof if rs("table_name") = sTableName then response.write "" response.write "" response.write "" response.write "" response.write "" response.write "" response.write "" end if rs.movenext loop response.write "
Indexes
Index Name Indexed Column Primary Key Unique Action
Unable to get indexes for Dsn connections.
" & rs("Index_name") & "" & rs("column_name") & "" & rs("prImary_key") & "" & rs("unIque") & "" if bFldDel then %> ">remove <% end if response.write "
" & vbCrLf CloseRS %>