Click here to Skip to main content
15,894,405 members
Articles / Web Development / IIS

Universal Table Editor

Rate me:
Please Sign up or sign in to vote.
4.86/5 (117 votes)
11 May 2003 1.6M   12.3K   275  
Viewer and Editor for any table in any Database you can reach from your IIS/PWS.
<%
'---------------------------------------------------------------------------
'
'   Project:    UTE - (U)niversal ASP (T)able (E)ditor
'
'   Module:     UTE Definitions
'
'   Version:    3.01
'
'   Comments:   All of UTEs "easy to change" definitions.
'
'---------------------------------------------------------------------------
'
'   (c) in 2000-2003 by Tom Wellige                    
'   http://www.wellige.com  mailto:tom@wellige.com     
'                                               
'   This project is released under the "GNU General Public License (GPL)" 
'   http://www.gnu.org/licenses/gpl.html
'
'   and is maintained on SourceForge at
'   http://sourceforge.net/projects/ute-asp/
'
'   and can also be found on CodeProject at
'   http://www.codeproject.com/asp/ute.asp
'
'---------------------------------------------------------------------------
%>
<!--#include file ="adovbs.inc"-->
<!--#include file ="ute_language_en.inc"-->
<!--#include file ="ute_adolib.inc"-->
<!--#include file ="ute_class.inc"-->
<%
'---------------------------------------------------------------------------
' Definitions
'
Const sUTELongName         = "Universal Table Editor"
Const sUTEShortName        = "UTE"
Const sUTEVersion          = "v3.01"
Const sUTELink             = "http://www.codeproject.com/asp/ute.asp"

'---------------------------------------------------------------------------
' "public" URL Parameter
'
Const sParamTable          = "name"                ' name of table
Const sParamPKey           = "pkey"                ' e.g. pkey1, pkey2, ... pkeyn
Const sParamSortFields     = "sorted"              ' sort fields alphabetically (1=true, 0=false, default=0)

'---------------------------------------------------------------------------
' "private" URL Parameter
'
Const sParamPage           = "page"                ' current page
Const sParamPageSize       = "pagesize"            ' page size (default=10)
Const sParamSort           = "sort"                ' sort field
Const sParamSortDir        = "sortdir"             ' sort direction  (asc, desc, default=asc) 
Const sParamMode           = "mode"                ' MD_TABLE, MD_FORM, MD_EXPORT
Const sParamFormMode       = "formmode"            ' MD_INSERT, MD_EDIT, MD_DELETE
Const sParamRecord         = "record"              ' editing or deleting record
Const sParamDefs           = "definitions"         ' show field definitions (1=true, 0=false, default=0)
Const sParamSQL            = "sql"                 ' show sql statement  (1=true, 0=false, default=0)
Const sParamSubmitted      = "submitted"           ' flag to signal that page was submitted (1=true, 0=false)
Const sParamFilterCount    = "fltcount"            ' number of filters
Const sParamFilterField    = "fltfield"            ' field to filter for, e.g.: fltfield1, fltfield1, ... fltfieldn
Const sParamFilterCompare  = "fltcomp"             ' comparison for filter, e.g.: fltcomp1, fltcomp2, ... fltcompn
Const sParamFilterValue    = "fltvalue"            ' value to filter for, e.g.: fltvalue1, fltvalue2, ... fltvaluen
Const sParamFilterCombine  = "fltcomb"             ' combine filters, e.g.: fltcomb1, fltcomb2, ... fltcombn
Const sParamFilterError    = "flterror"            ' error message

'---------------------------------------------------------------------------
' form fields
'
Const sFormUTEFieldPrefix  = "?"                   ' all UTE own form fields statr with this character. This must
                                                   ' not be a valid SQL fieldname character to ensure integrity
Const sFormButton          = "ute_form_button"     ' name of ok and cancel buttons in form
Const sFormIdentField      = "ute_ident_field"     ' name of field to identify a record to be edited
Const sFormIdentType       = "ute_ident_type"      ' type of field to identify a record to be edited
Const sFormIdentValue      = "ute_ident_value"     ' value of field to identify a record to be edited
Const sFormCount           = "ute_count"           ' number of filters 
Const sFormField           = "ute_field"           ' name of "field" input in filter form
Const sFormCompare         = "ute_compare"         ' name of "compare" input in filter form
Const sFormValue           = "ute_value"           ' name of "value" input in filter form
Const sFormCombine         = "ute_combine"         ' name of "combine" input in filter form

'---------------------------------------------------------------------------
' default values
'
Const DEF_PAGE             = 1                     ' default page
Const DEF_PAGE_SIZE        = 10                    ' default number of records per page
Const DEF_SORT_FIELDS      = False                 ' default sort fields alphabetically (columns)
Const DEF_SORT_DIR         = "asc"                 ' default sort direction: SORT_ASC
Const DEF_VIEW_DEFINITIONS = False                 ' default show field definitions
Const DEF_VIEW_SQL         = False                 ' default show sql statement
Const DEF_PK_DETECTION     = True                  ' default primary key detection

Const DEF_MODE             = 1                     ' default view mode: MD_TABLE
Const DEF_FORM_MODE        = 1                     ' default form mode: MD_INSERT

Const DEF_READONLY         = False                 ' default readonly
Const DEF_LIST_TABLES      = True                  ' default list all table in DB
Const DEF_SHOW_DEF_LINK    = True                  ' default show view definitions link
Const DEF_EXPORT_LINK      = True                  ' default export data link
Const DEF_SQL_LINK         = True                  ' default show sql link
Const DEF_FILTERS          = True                  ' default show and activate filters

Const DEF_IMAGE_DIR        = "images/"             ' directory where the images are

Const DEF_EXPORT_SEP       = ","                   ' seperator chacarter between values
Const DEF_EXPORT_VAL       = """"                  ' chararcter a value is placed into

Const DEF_MAX_INPUT_LENGTH = 58                    ' max length of INPUT
Const DEF_MEMO_COLS        = 50                    ' number of cols of TEXTAREA
Const DEF_MEMO_ROWS        = 8                     ' number of rows of TEXTAREA
Const DEF_MEMO_COL_WIDTH   = 300                   ' width of MEMO column in table

Const DEF_NUM_FILTER       = 1                     ' default number of filters
Const DEF_MAX_FILTER       = 10                    ' maximum number of filters
Const DEF_MAX_FILTER_LEN   = 50                    ' max length of filter INPUT
Const DEF_FILTER_SIZE      = 30                    ' size of filter INPUT

'---------------------------------------------------------------------------
' view modes and form modes
'
Const MD_DATABASE          = 0                     ' list tables of current database
Const MD_TABLE             = 1                     ' table view mode
Const MD_FORM              = 2                     ' form view mode
Const MD_EXPORT            = 3                     ' export mode
Const MD_FILTER            = 4                     ' display filter form

Const MD_INSERT            = 1                     ' insert mode
Const MD_EDIT              = 2                     ' edit mode
Const MD_DELETE            = 3                     ' delete mode

'---------------------------------------------------------------------------
' other defines
'
Const SORT_ASC             = "asc"
Const SORT_DESC            = "desc"

'---------------------------------------------------------------------------
' FileOpen iomode Values
'
Const fsoForReading        = 1
Const fsoForWriting        = 2
Const fsoForAppending      = 8
Const fsoCreateIfNotExist  = True

%>

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
CEO Student
Germany Germany
Tom is in software development for about 15 years. He started with a SHARP MZ80k in Basic and Assembly Language. After collecting some experiance on an ATARI 1040ST he bought his very first IBM XT 286 (incl. 287!) and started to program in Turbo Pascal. He became very familiar with Borland's Turbo Vision and over the last years did a lot of development in C++ (MFC), Visual Basic, VB Script, ASP and SQL. He currently works as senior consultant for Swyx Solutions GmbH, based in Dortmund, Germany.
His absolute favourite is Guinness Wink | ;-) Sláinte!

Comments and Discussions