Adding new database fields Version 2.7 ========================== Heres a quick tutorial on what needs to be changed if you require additional fields in the supplied database. I make the assumption you know how to use FP2000 or notepad etc as your file editor (I use textpad), you know basic asp syntax and that you are adding a text field. Please make sure you have completed all of the steps! The files that need to be modified are : * /includes/a_config.asp * /includes/a_users.asp * /includes/inc_text.asp * /admin_users.asp * /register.asp * The database :c) NOTE : Any line numbers are approximations as they may change slightly (or a lot:) from version to version. Only the code BETWEEN the markers '##### is required ============ a_config.asp ============ This file contains the important information required. NOTE: [] brackets are only used to denote changes Step (1) <-- locate this step in the a_config file -------- Dim the new column name on a new line '##### Private [new_column_name] '##### Step (2) -------- Increment the array for column count (Add 1 for each column added) '##### Dim arrValInput(30) ---> becomes Dim arrValInput(31) Dim arrErrMsg(30) ---> becomes Dim arrErrMsg(31) ReDim arrFieldNames(30) ---> becomes Dim arrFieldNames(31) Dim arrMaxLth(30) ---> becomes Dim arrMaxLth(31) '##### Step (3) -------- Add column name to the available fields list (used in SQL statement) New fields MUST be added to the end of the SQL statement '##### CONST strAllFields = " existing list + , [new_column_name]" '##### Add new "0" to the show fields loop '##### CONST strDefShowFields = " existing list + 0" '##### Step (4) -------- Add new column max length (the character length the database design allows) '##### arrMaxLth([count]) = [database field length] '##### --> increment last highest value + 1 (1 based array) Step (5) -------- Add value to "Sub GetExtendedInfo" - Used to fetch value from database '##### [new_column_name] = objRs.fields.item([count]).value '##### --> increment last highest value + 1 (0 based value) NOTE this is 0 based, the value will be 1 lower than step (4) Step (6) -------- Add value to "Sub SetExtendedInfo" - Used to set value in database '##### If mid(strShowField,[count+1],1) = "1" OR isAdminUpdate then objRs.fields.item([count]).value = [new_column_name] '##### --> increment last highest value + 1 (0 based value) If the value is a "checkbox", use : If mid(strShowField,[count+1],1) = "1" OR isAdminUpdate then objRs.fields.item([count]).value = IF([new_column_name]&""<>"",1,0) If the value is "radio" then use : If mid(strShowField,[count+1],1) = "1" OR isAdminUpdate then objRs.fields.item([count]).value = IF([new_column_name]="1",1,0) Step (7) -------- Add value to "Sub ValidateExtendedInfo" - Used to validate form input '##### [new_column_name] = ValidateInput(Request.Form("[new_column_name]"),[validate],[count]) '##### --> increment last highest value + 1 (1 based array) [validate] denotes validation. Values are : [1] Date [2] Numeric [3] Text string [4] Bool [5] E-mail =============== inc_text.asp =============== This file contains the text values that are displayed to the user Add new text for column name in inc_text.asp This text is the name used when the line is displayed in the register or admin pages. '##### CONST txt[new_column_name] = "Column description" '##### =============== admin_users.asp =============== All changes to admin_users are for display purposes only. Add new Display input (approx line 82) '##### Call AInputRow("[new_column_name]",txt[new_column_name],[new_column_name],"[input type]",[count],[style]) '##### [input type] is the display type for the form input. (formated in /includes/a_html.asp) Values used may be : text - normal text box is shown memo - expanding text box checkbox - single check box radio - yes / no radio buttons (database must be bit/yes/no type) hidden - hidden form input list - a valid list must be set in /includes/a_app_list.asp [Count] is 1 based array and should equal step (4) from above [style] is the style sheet applied Values : [1] Text [2] Date [3] Numeric [4] integer =============== register.asp =============== The file used to register or update the user. The 3 lines of code (as below) can be placed in any order within this file. This will dictate the order in which they are displayed to the user. Add new Display input (approx line 194) '##### If (Mid(strShowField, [count], 1) = "1") then Call InputRow("[new_column_name]",txt[new_column_name],new_column_name,"[input type]",[count],[style]) End if '##### [input type] is the display type for the form input. (formated in /includes/a_register.asp) Values used may be : text - normal text box is shown memo - expanding text box checkbox - single check box radio - yes / no radio buttons hidden - hidden form input list - a valid list must be set in /includes/a_app_list.asp multi - a valid list must be set in /includes/a_app_list.asp [Count] is 1 based array and should equal step (4) from above [style] is the style sheet applied Values : [1] Text [2] Date [3] Numeric [4] integer =============== a_users.asp =============== Add new array (approx line 189) '##### [new_column_name] = aResults([count],iStart) '##### [Count] is 0 based array and should be 1 less than step (4) from above And that should be it!