<% '====================== Variables ================================== id = Request.Form("id") Submit = Request.Form("Submit") set oConn = server.createobject("adodb.connection") oConn.open strConn %> <% If Submit = "Delete" Then %>

Delete Retailer


Are your sure you want to delete that retailer?

 


<% Else '====================== UPDATE or ADD ================================== If Submit = "Update" Then 'This is the user's first visit to this update page SubmitValue = "Save changes" sql = "SELECT * " _ & " FROM Retailers " _ & " WHERE ID = " & id set rs = oConn.execute(sql) rs.MoveFirst Else 'user wants to add a record to employee table SubmitValue = "Add record" sql = "SELECT TOP 1 * " _ & " FROM Retailers " set rs = oConn.execute(sql) rs.MoveFirst End If Dim arrFields() ReDim arrFields(1,rs.fields.count) I = 0 For Each Item in rs.fields arrFields(0,I) = Item.name If SubmitValue = "Add record" Then arrFields(1,I) = "" Else arrFields(1,I) = Item End If I=I+1 Next %> <%If Submit = "Update" Then 'print update form header%>

Edit Retailer


To alter the attributes of this retailer, please edit the fields and then click the 'Edit' button.

<%Else 'print add form header%>

Add Retailer


To add an retailer to your system, please complete the fields below for the new retailer, then click the 'Add' button.

<%End If 'Now print the body of the add/update form bgcolor = "tablebgcolor2" %>
<% For I = 0 to Ubound(arrFields , 2)-1 bgcolor = ColorSwitch(bgcolor) %> <%SELECT CASE arrFields(0,I) CASE "ID","City","State","Lon","Lat" %> <%CASE "PostalCode" If Submit = "Update" Then%> <%Else%> <%End If%> <%CASE ELSE%> <%END SELECT%> <%Next%>
<%=arrFields(0,I)%><%=arrFields(1,I)%><%=arrFields(1,I)%>
 


<% End If Set oConn= Nothing %>