navigation
a webmaster learning community
     Home    Register     Search      Help      Login    
Sponsors

Shopping Cart Software
Ecommerce software integrated into Frontpage, Dreamweaver and Golive templates. No monthly fees and available in ASP and PHP versions.

Website Templates
We also have a wide selection of Dreamweaver, Expression Web and Frontpage templates as well as webmaster tools and CSS layouts.

Frontpage website templates
Creative Website Templates for FrontPage, Dreamweaver, Flash, SwishMax

Search Forums
 

Advanced search
Recent Posts

 Todays Posts
 Most Active posts
 Posts since last visit
 My Recent Posts
 Mark posts read

Microsoft MVP

 

Form showing database results

 
View related threads: (in this forum | in all forums)

Logged in as: Guest
Users viewing this topic: none
Printable Version 

All Forums >> Web Development >> Dreamweaver Help >> Form showing database results
Page: [1]
 
cdrees

 

Posts: 42
Joined: 8/4/2004
Status: offline

 
Form showing database results - 7/9/2007 11:21:20   
I have a database that has an "Edit Records" section.

The form that shows the edited record has several fields that are pulling from separate tables.

(i.e. Server Models and Deployment Reasons).

Both of those fields pull from two separate tables, but when the "edit form" is displayed, it shows the top record in the list, not the one currently selected.

In other words, the Server Models table may have the following in it's DB:

DL360G4
DL360G5
DL380G4
DL380G5

The actual record might have DL380G5 already entered, but when the edit form is displayed, it just shows the top record in the list (DL360G4). If the user doesn't catch it and hits update, it changes the server model.

I'm not sure how to have it display the currently active value for the field.

Here's the code for the actual field (using Dreamweaver CS3 with Developer toolbox):
<td><input type="text" name="serial" id="serial" value="<%=(KT_escapeAttribute(rssrvInventory.Fields.Item("serial").Value))%>" size="32" />
                <%=(tNGs.displayFieldHint("serial"))%> <%=(tNGs.displayFieldError("srvInventory", "serial"))%> </td>



Here's the underlying code to connect, return records, etc (using Dreamweaver CS3 with Developer toolbox):

<%@LANGUAGE="VBSCRIPT"%>
<!-- #include file="includes/wdg/WDG.asp" -->
<!--#include file="Connections/srv_inv_all.asp" -->
<!--#include file="includes/common/KT_common.asp" -->
<!--#include file="includes/tNG/tNG.inc.asp" -->
<%
'Make a transaction dispatcher instance
Dim tNGs: Set tNGs = new tNG_dispatcher
tNGs.Init ""
%>
<%
' Start trigger
Dim formValidation: Set formValidation = new tNG_FormValidation
formValidation.Init
formValidation.addField "server_name", true, "text", "", "", "", ""
formValidation.addField "serial", true, "text", "", "", "", ""
tNGs.prepareValidation formValidation
' End trigger
%>
<%
'start Trigger_CheckUnique trigger
'remove this line if you want to edit the code by hand
Function Trigger_CheckUnique (ByRef tNG)
  Dim tblFldObj: Set tblFldObj = new tNG_CheckUnique
  tblFldObj.Init tNG
  tblFldObj.setTable "srvInventory"
  tblFldObj.setFieldName "serial"
  tblFldObj.setErrorMsg "Serial already exists in database. Please recheck."
  Set Trigger_CheckUnique = tblFldObj.Execute()
End Function
'end Trigger_CheckUnique trigger
%>
<%
Dim rsReason
Dim rsReason_cmd
Dim rsReason_numRows

Set rsReason_cmd = Server.CreateObject ("ADODB.Command")
rsReason_cmd.ActiveConnection = MM_srv_inv_all_STRING
rsReason_cmd.CommandText = "SELECT * FROM dbo.srvDeployReason" 
rsReason_cmd.Prepared = true

Set rsReason = rsReason_cmd.Execute
rsReason_numRows = 0
%>
<%
Dim rsModel
Dim rsModel_cmd
Dim rsModel_numRows

Set rsModel_cmd = Server.CreateObject ("ADODB.Command")
rsModel_cmd.ActiveConnection = MM_srv_inv_all_STRING
rsModel_cmd.CommandText = "SELECT * FROM dbo.srvModels" 
rsModel_cmd.Prepared = true

Set rsModel = rsModel_cmd.Execute
rsModel_numRows = 0
%>
<%
' Make an update transaction instance
Dim upd_srvInventory: Set upd_srvInventory = new tNG_update
upd_srvInventory.init MM_srv_inv_all_STRING
tNGs.addTransaction upd_srvInventory
' Register triggers
upd_srvInventory.registerTrigger Array("STARTER", "Trigger_Default_Starter", 1, "POST", "KT_Update1")
upd_srvInventory.registerTrigger Array("BEFORE", "Trigger_Default_FormValidation", 10, formValidation)
upd_srvInventory.registerTrigger Array("END", "Trigger_Default_Redirect", 99, "srv_showall.asp")
upd_srvInventory.registerTrigger Array("BEFORE", "Trigger_CheckUnique", 30)
' Add columns
upd_srvInventory.setTable "srvInventory"
upd_srvInventory.addColumn "server_name", "STRING_TYPE", "POST", "server_name"
upd_srvInventory.addColumn "status", "STRING_TYPE", "POST", "status"
upd_srvInventory.addColumn "redeploy_reason", "STRING_TYPE", "POST", "redeploy_reason"
upd_srvInventory.addColumn "serial", "STRING_TYPE", "POST", "serial"
upd_srvInventory.addColumn "model", "STRING_TYPE", "POST", "model"
upd_srvInventory.addColumn "cpu", "STRING_TYPE", "POST", "cpu"
upd_srvInventory.addColumn "cpu_speed", "STRING_TYPE", "POST", "cpu_speed"
upd_srvInventory.addColumn "ram", "STRING_TYPE", "POST", "ram"
upd_srvInventory.addColumn "disk_type", "STRING_TYPE", "POST", "disk_type"
upd_srvInventory.addColumn "disk_total_num", "STRING_TYPE", "POST", "disk_total_num"
upd_srvInventory.addColumn "disk_size", "STRING_TYPE", "POST", "disk_size"
upd_srvInventory.addColumn "power_sup_num", "STRING_TYPE", "POST", "power_sup_num"
upd_srvInventory.addColumn "store_only", "CHECKBOX_YN_TYPE", "POST", "store_only"
upd_srvInventory.addColumn "history", "STRING_TYPE", "POST", "history"
upd_srvInventory.addColumn "date_added", "DATE_TYPE", "POST", "date_added"
upd_srvInventory.addColumn "date_redeployed", "DATE_TYPE", "POST", "date_redeployed"
upd_srvInventory.setPrimaryKey "id", "NUMERIC_TYPE", "GET", "recordID"
%>
<%
'Execute all the registered transactions
tNGs.executeTransactions
%>





Thanks very much!!

-Chris
mar0364

 

Posts: 3026
Joined: 4/5/2002
From: Florida, US
Status: offline

 
RE: Form showing database results - 7/13/2007 17:56:15   
Did you get this sorted out?

_____________________________

Easy Web

“Stay committed to your decisions, but stay flexible in your approach.”


(in reply to cdrees)
Page:   [1]

All Forums >> Web Development >> Dreamweaver Help >> Form showing database results
Page: [1]
Jump to: 1





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts