Link to home
Start Free TrialLog in
Avatar of dtolo
dtolo

asked on

I need to make a page that uses one table in SQL to update another. ASAP

I posted a question in the asp Side that is giving them trouble because I have to use front page.  It is worth 500 points.  Follow this link:


https://www.experts-exchange.com/questions/21085175/I-need-to-make-a-page-that-uses-one-table-in-SQL-to-update-another.html#11739119


Avatar of rcmb
rcmb

I am not quite sure what you are looking for --

In your first form is the form only displaying a single drop-down with the employees number and then do you desire this to submit to another form with the emplyees information so the employee can update their data?  

--OR--

Is your first form listing all of this data and you just desire to have it updated?

RCMB
Avatar of dtolo

ASKER

I want the first form (that is generated from the employee table to update the register table.  The tables are in the same SQL dbase.
ASKER CERTIFIED SOLUTION
Avatar of rcmb
rcmb

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of dtolo

ASKER

RCBM,

Thank you this looks great!  I am going to try this right now.  At first glance it seems that on page one I should just reverse the order of the drop - Down list and make Employee number first, because I want the Employee to sign up by choosing thier employee number since there are a lot of duplicate last names.

I will get back to to you after I try it out.

~David
David,

You are right if you have an issue with alot of the same names. If you are just using employee numbers then do something like this in the first page

<option><%=FP_FieldHTML(fp_rs,"EmpNum")%></option>

This will just have the employee number displayed and will not require an option value as it will submit the number to page 2.

R/RCMB
Avatar of dtolo

ASKER

RCBM,

I like this solution so far.  I am getting an error message on page 2 from my browser:

Technical Information (for support personnel)

Error Type:
Microsoft VBScript runtime (0x800A000D)
Type mismatch: 'fp_rs'
/cssd/prototype/TA/page2.asp, line 48


Browser Type:
Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.0.3705; .NET CLR 1.1.4322)

Page:
GET /cssd/prototype/TA/page2.asp?EmployeeNumber=524503&B1=Submit

Time:
Monday, August 09, 2004, 12:57:29 PM


This is the code from my whole page:

<head>
<% ' FP_ASP -- ASP Automatically generated by a Frontpage Component. Do not Edit.
FP_CharSet = "windows-1252"
FP_CodePage = 1252 %>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>New Page 1</title>
</head>

<body>

<form>
      <nobr>
      <!--webbot bot="DatabaseRegionStart" s-columnnames="StudentID,EmployeeNumber,FirstName,LastName,Address,City,StateOrProvince,PostalCode,PhoneNumber,Major,Email,ThirdName,FourthName,Address1,Address2,Town,State,Zip,PhoneExtension" s-columntypes="3,202,200,200,200,202,202,202,202,202,200,200,200,200,200,200,200,200,200" s-dataconnection="TA-UPDATE" b-tableformat="FALSE" b-menuformat="TRUE" s-menuchoice="EmployeeNumber" s-menuvalue="EmployeeNumber" b-tableborder="TRUE" b-tableexpand="TRUE" b-tableheader="TRUE" b-listlabels="TRUE" b-listseparator="TRUE" i-listformat="0" b-makeform="FALSE" s-recordsource="Students" s-displaycolumns="EmployeeNumber" s-criteria="[EmployeeNumber] EQ {EmployeeNumber} +" s-order s-sql="SELECT * FROM Students WHERE (EmployeeNumber =  '::EmployeeNumber::')" b-procedure="FALSE" clientside suggestedext="asp" s-defaultfields="EmployeeNumber=" s-norecordsfound="No records returned." i-maxrecords="0" i-groupsize="0" botid="0" u-dblib="../_fpclass/fpdblib.inc" u-dbrgn1="../_fpclass/fpdbrgn1.inc" u-dbrgn2="../_fpclass/fpdbrgn2.inc" preview=" &lt;span style=&quot;color: rgb(0,0,0); background-color: rgb(255,255,0)&quot;&gt;Database&lt;/span&gt; " startspan --><!--#include file="../_fpclass/fpdblib.inc"-->
<% if 0 then %>
<SCRIPT Language="JavaScript">
document.write("<div style='background: yellow; color: black;'>The Database Results component on this page is unable to display database content. The page must have a filename ending in '.asp', and the web must be hosted on a server that supports Active Server Pages.</div>");
</SCRIPT>
<% end if %>
<%
fp_sQry="SELECT * FROM Students WHERE (EmployeeNumber =  '::EmployeeNumber::')"
fp_sDefault="EmployeeNumber="
fp_sNoRecords="No records returned."
fp_sDataConn="TA-UPDATE"
fp_iMaxRecords=0
fp_iCommandType=1
fp_iPageSize=0
fp_fTableFormat=False
fp_fMenuFormat=True
fp_sMenuChoice="EmployeeNumber"
fp_sMenuValue="EmployeeNumber"
fp_sColTypes="&StudentID=3&EmployeeNumber=202&FirstName=200&LastName=200&Address=200&City=202&StateOrProvince=202&PostalCode=202&PhoneNumber=202&Major=202&Email=200&ThirdName=200&FourthName=200&Address1=200&Address2=200&Town=200&State=200&Zip=200&PhoneExtension=200&"
fp_iDisplayCols=1
fp_fCustomQuery=False
BOTID=0
fp_iRegion=BOTID
%>
<!--webbot bot="DatabaseRegionStart" endspan i-checksum="59487" --><select NAME="EmployeeNumber" SIZE="1">
      <!--webbot bot="AspInclude" clientside u-incfile="../_fpclass/fpdbrgn1.inc" startspan --><!--#include file="../_fpclass/fpdbrgn1.inc"--><!--webbot bot="AspInclude" endspan i-checksum="52766" -->
      <option><%=FP_FieldHTML(fp_rs,"EmployeeNumber")%></option>
      <!--webbot bot="AspInclude" clientside u-incfile="../_fpclass/fpdbrgn2.inc" startspan --><!--#include file="../_fpclass/fpdbrgn2.inc"--><!--webbot bot="AspInclude" endspan i-checksum="52830" -->
      
      

<%
'Add additional fields as necessary
varLname = fp_rs("LastName")
varFname = fp_rs("FirstName")
varEmpNum = fp_rs("EmployeeNumber")
varEmail = fp_rs("Email")
%>
      
      </select><!--webbot bot="DatabaseRegionEnd" b-tableformat="FALSE" b-menuformat="TRUE" u-dbrgn2="../_fpclass/fpdbrgn2.inc" i-groupsize="0" clientside preview=" &lt;span style=&quot;color: rgb(0,0,0); background-color: rgb(255,255,0)&quot;&gt;Results&lt;/span&gt; " startspan --><!--webbot bot="DatabaseRegionEnd" endspan --></nobr></form>

<% response.redirect "page3.asp?LastName=" & varLname & "&FirstName=" & varFname & "&EmployeeNumber=" & varEmpNum & "&Email=" & varEmail %>

</body>

Line 48 where the error is generated is:

varLname = fp_rs("LastName")
Avatar of dtolo

ASKER

Disregard that last part.  I solved the error (it was an error I made).  It seems to work fine .. but the register table is not getting updated.  I will recheck the code on page3.asp
Avatar of dtolo

ASKER

This is the code from page 3.  I tested the query and it seems fine, but the records are not getting updated.


<body>

<table>
      <tbody>
            <!--webbot bot="DatabaseRegionStart" s-columnnames s-columntypes s-dataconnection="TA-UPDATE" b-tableformat="TRUE" b-menuformat="FALSE" s-menuchoice s-menuvalue b-tableborder="FALSE" b-tableexpand="FALSE" b-tableheader="FALSE" b-listlabels="TRUE" b-listseparator="TRUE" i-listformat="0" b-makeform="FALSE" s-recordsource s-displaycolumns s-criteria s-order s-sql="INSERT INTO Register (LastName, FirstName, EmployeeNumber, Email) VALUES ('::LastName::', '::FirstName::', '::EmployeeNumber::', '::Email::')" b-procedure="FALSE" clientside suggestedext="asp" s-defaultfields="LastName=&amp;amp;FirstName=&amp;amp;EmployeeNumber=&amp;amp;Email=" s-norecordsfound="No records returned." i-maxrecords="256" i-groupsize="0" botid="0" u-dblib="../_fpclass/fpdblib.inc" u-dbrgn1="../_fpclass/fpdbrgn1.inc" u-dbrgn2="../_fpclass/fpdbrgn2.inc" tag="TBODY" preview="&lt;tr&gt;&lt;td colspan=64 bgcolor=&quot;#FFFF00&quot; width=&quot;100%&quot;&gt;&lt;font color=&quot;#000000&quot;&gt;This is the start of a Database Results region.&lt;/font&gt;&lt;/td&gt;&lt;/tr&gt;" startspan b-UseDotNET="FALSE" CurrentExt sa-InputTypes b-DataGridFormat="FALSE" b-DGridAlternate="TRUE" sa-CritTypes b-WasTableFormat="TRUE" --><!--#include file="../_fpclass/fpdblib.inc"-->
<% if 0 then %>
<SCRIPT Language="JavaScript">
document.write("<div style='background: yellow; color: black;'>The Database Results component on this page is unable to display database content. The page must have a filename ending in '.asp', and the web must be hosted on a server that supports Active Server Pages.</div>");
</SCRIPT>
<% end if %>
<%
fp_sQry="INSERT INTO Register (LastName, FirstName, EmployeeNumber, Email) VALUES ('::LastName::', '::FirstName::', '::EmployeeNumber::', '::Email::')"
fp_sDefault="LastName=&FirstName=&EmployeeNumber=&Email="
fp_sNoRecords="<tr><td colspan=16 align=""LEFT"" width=""100%"">No records returned.</td></tr>"
fp_sDataConn="TA-UPDATE"
fp_iMaxRecords=256
fp_iCommandType=1
fp_iPageSize=0
fp_fTableFormat=True
fp_fMenuFormat=False
fp_sMenuChoice=""
fp_sMenuValue=""
fp_sColTypes="&"
fp_iDisplayCols=16
fp_fCustomQuery=True
BOTID=0
fp_iRegion=BOTID
%>
<!--#include file="../_fpclass/fpdbrgn1.inc"-->
<!--webbot bot="DatabaseRegionStart" endspan i-checksum="52006" --><!--webbot bot="DatabaseRegionEnd" b-tableformat="TRUE" b-menuformat="FALSE" u-dbrgn2="../_fpclass/fpdbrgn2.inc" i-groupsize="0" clientside tag="TBODY" preview="&lt;tr&gt;&lt;td colspan=64 bgcolor=&quot;#FFFF00&quot; width=&quot;100%&quot;&gt;&lt;font color=&quot;#000000&quot;&gt;This is the end of a Database Results region.&lt;/font&gt;&lt;/td&gt;&lt;/tr&gt;" startspan --><!--#include file="../_fpclass/fpdbrgn2.inc"-->
<!--webbot bot="DatabaseRegionEnd" endspan i-checksum="56926" --></tbody>
</table>
<% response.redirect "registered.htm" %>
</body>

Any Idea what I am doing wrong?
A question for you on the page 3 issue

I assumed you are creating a record in the register table but you indicate the "table is not getting updated". Are you attempting to update an existing record in the register table or are you trying to create a new record?

The difference here is in the SQL statement in that page 3 would change from INSERT INTO... to UPDATE...

Let me know.

RCMB
In page two what does the last line look like (before the </body> and </html> tags)?

Lets make sure we are getting the data from page two.

Comment out the reponse.redirect by placing a ' before response and then enter this:

<%=varLname%><br>
<%=varFname%><br>
<%=varEmpNum%><br>
<%=varEmail%>

If all is working correctly you should see the employees last and first name, employee number and email address after you select their employee number from the first page.

RCMB


Avatar of dtolo

ASKER

OK,
You are right.

I am adding not updating.

Page 2 before modifications:

<table>
      <tbody>
            <!--webbot bot="DatabaseRegionStart" s-columnnames="StudentID,EmployeeNumber,FirstName,LastName,Address,City,StateOrProvince,PostalCode,PhoneNumber,Major,Email,ThirdName,FourthName,Address1,Address2,Town,State,Zip,PhoneExtension" s-columntypes="3,202,200,200,200,202,202,202,202,202,200,200,200,200,200,200,200,200,200" s-dataconnection="TA-UPDATE" b-tableformat="TRUE" b-menuformat="FALSE" s-menuchoice s-menuvalue b-tableborder="FALSE" b-tableexpand="FALSE" b-tableheader="FALSE" b-listlabels="TRUE" b-listseparator="TRUE" i-listformat="0" b-makeform="FALSE" s-recordsource="Students" s-displaycolumns="EmployeeNumber" s-criteria="[EmployeeNumber] EQ {EmployeeNumber} +" s-order s-sql="SELECT * FROM Students WHERE (EmployeeNumber =  '::EmployeeNumber::')" b-procedure="FALSE" clientside suggestedext="asp" s-defaultfields="EmployeeNumber=" s-norecordsfound="No records returned." i-maxrecords="0" i-groupsize="0" botid="0" u-dblib="../_fpclass/fpdblib.inc" u-dbrgn1="../_fpclass/fpdbrgn1.inc" u-dbrgn2="../_fpclass/fpdbrgn2.inc" tag="TBODY" preview="&lt;tr&gt;&lt;td colspan=64 bgcolor=&quot;#FFFF00&quot; width=&quot;100%&quot;&gt;&lt;font color=&quot;#000000&quot;&gt;This is the start of a Database Results region.&lt;/font&gt;&lt;/td&gt;&lt;/tr&gt;" startspan --><!--#include file="../_fpclass/fpdblib.inc"-->
<% if 0 then %>
<SCRIPT Language="JavaScript">
document.write("<div style='background: yellow; color: black;'>The Database Results component on this page is unable to display database content. The page must have a filename ending in '.asp', and the web must be hosted on a server that supports Active Server Pages.</div>");
</SCRIPT>
<% end if %>
<%
fp_sQry="SELECT * FROM Students WHERE (EmployeeNumber =  '::EmployeeNumber::')"
fp_sDefault="EmployeeNumber="
fp_sNoRecords="<tr><td colspan=1 align=""LEFT"" width=""100%"">No records returned.</td></tr>"
fp_sDataConn="TA-UPDATE"
fp_iMaxRecords=0
fp_iCommandType=1
fp_iPageSize=0
fp_fTableFormat=True
fp_fMenuFormat=False
fp_sMenuChoice=""
fp_sMenuValue=""
fp_sColTypes="&StudentID=3&EmployeeNumber=202&FirstName=200&LastName=200&Address=200&City=202&StateOrProvince=202&PostalCode=202&PhoneNumber=202&Major=202&Email=200&ThirdName=200&FourthName=200&Address1=200&Address2=200&Town=200&State=200&Zip=200&PhoneExtension=200&"
fp_iDisplayCols=1
fp_fCustomQuery=False
BOTID=0
fp_iRegion=BOTID
%>
<!--#include file="../_fpclass/fpdbrgn1.inc"-->
<!--webbot bot="DatabaseRegionStart" endspan i-checksum="50921" -->

<%
'Add additional fields as necessary
varLname = fp_rs("LastName")
varFname = fp_rs("FirstName")
varEmpNum = fp_rs("EmployeeNumber")
varEmail = fp_rs("Email")
%>
<tr>
                  <td>
                  <!--webbot bot="DatabaseResultColumn" s-columnnames="StudentID,EmployeeNumber,FirstName,LastName,Address,City,StateOrProvince,PostalCode,PhoneNumber,Major,Email,ThirdName,FourthName,Address1,Address2,Town,State,Zip,PhoneExtension" s-column="EmployeeNumber" b-tableformat="TRUE" b-hashtml="FALSE" b-makelink="FALSE" clientside b-MenuFormat preview="&lt;font size=&quot;-1&quot;&gt;&amp;lt;&amp;lt;&lt;/font&gt;EmployeeNumber&lt;font size=&quot;-1&quot;&gt;&amp;gt;&amp;gt;&lt;/font&gt;" startspan --><%=FP_FieldVal(fp_rs,"EmployeeNumber")%><!--webbot bot="DatabaseResultColumn" endspan i-checksum="41846" --></td>
            </tr>
            <!--webbot bot="DatabaseRegionEnd" b-tableformat="TRUE" b-menuformat="FALSE" u-dbrgn2="../_fpclass/fpdbrgn2.inc" i-groupsize="0" clientside tag="TBODY" preview="&lt;tr&gt;&lt;td colspan=64 bgcolor=&quot;#FFFF00&quot; width=&quot;100%&quot;&gt;&lt;font color=&quot;#000000&quot;&gt;This is the end of a Database Results region.&lt;/font&gt;&lt;/td&gt;&lt;/tr&gt;" startspan --><!--#include file="../_fpclass/fpdbrgn2.inc"-->
<!--webbot bot="DatabaseRegionEnd" endspan i-checksum="56926" --></tbody>
</table>
<% response.redirect "page3.asp?LastName=" & varLname & "&FirstName=" & varFname & "&EmployeeNumber=" & varEmpNum & "&Email=" & varEmail %>
</body>

After:


<SCRIPT Language="JavaScript">
document.write("<div style='background: yellow; color: black;'>The Database Results component on this page is unable to display database content. The page must have a filename ending in '.asp', and the web must be hosted on a server that supports Active Server Pages.</div>");
</SCRIPT>
<% end if %>
<%
fp_sQry="SELECT * FROM Students WHERE (EmployeeNumber =  '::EmployeeNumber::')"
fp_sDefault="EmployeeNumber="
fp_sNoRecords="<tr><td colspan=1 align=""LEFT"" width=""100%"">No records returned.</td></tr>"
fp_sDataConn="TA-UPDATE"
fp_iMaxRecords=0
fp_iCommandType=1
fp_iPageSize=0
fp_fTableFormat=True
fp_fMenuFormat=False
fp_sMenuChoice=""
fp_sMenuValue=""
fp_sColTypes="&StudentID=3&EmployeeNumber=202&FirstName=200&LastName=200&Address=200&City=202&StateOrProvince=202&PostalCode=202&PhoneNumber=202&Major=202&Email=200&ThirdName=200&FourthName=200&Address1=200&Address2=200&Town=200&State=200&Zip=200&PhoneExtension=200&"
fp_iDisplayCols=1
fp_fCustomQuery=False
BOTID=0
fp_iRegion=BOTID
%>
<!--#include file="../_fpclass/fpdbrgn1.inc"-->
<!--webbot bot="DatabaseRegionStart" endspan i-checksum="50921" -->

<%
'Add additional fields as necessary
varLname = fp_rs("LastName")
varFname = fp_rs("FirstName")
varEmpNum = fp_rs("EmployeeNumber")
varEmail = fp_rs("Email")
%>
<tr>
                  <td>
                  <!--webbot bot="DatabaseResultColumn" s-columnnames="StudentID,EmployeeNumber,FirstName,LastName,Address,City,StateOrProvince,PostalCode,PhoneNumber,Major,Email,ThirdName,FourthName,Address1,Address2,Town,State,Zip,PhoneExtension" s-column="EmployeeNumber" b-tableformat="TRUE" b-hashtml="FALSE" b-makelink="FALSE" clientside b-MenuFormat preview="&lt;font size=&quot;-1&quot;&gt;&amp;lt;&amp;lt;&lt;/font&gt;EmployeeNumber&lt;font size=&quot;-1&quot;&gt;&amp;gt;&amp;gt;&lt;/font&gt;" startspan --><%=FP_FieldVal(fp_rs,"EmployeeNumber")%><!--webbot bot="DatabaseResultColumn" endspan i-checksum="41846" --></td>
            </tr>
            <!--webbot bot="DatabaseRegionEnd" b-tableformat="TRUE" b-menuformat="FALSE" u-dbrgn2="../_fpclass/fpdbrgn2.inc" i-groupsize="0" clientside tag="TBODY" preview="&lt;tr&gt;&lt;td colspan=64 bgcolor=&quot;#FFFF00&quot; width=&quot;100%&quot;&gt;&lt;font color=&quot;#000000&quot;&gt;This is the end of a Database Results region.&lt;/font&gt;&lt;/td&gt;&lt;/tr&gt;" startspan --><!--#include file="../_fpclass/fpdbrgn2.inc"-->
<!--webbot bot="DatabaseRegionEnd" endspan i-checksum="56926" --></tbody>
</table>
<% 'response.redirect "page3.asp?LastName=" & varLname & "&FirstName=" & varFname & "&EmployeeNumber=" & varEmpNum & "&Email=" & varEmail %>

<%=varLname%><br>
<%=varFname%><br>
<%=varEmpNum%><br>
<%=varEmail%>
</body>
Avatar of dtolo

ASKER

It is showing the info after I added your code.  I can't see why the records don't get added.
Avatar of dtolo

ASKER

RCBM,

On page 3 does there have to be code change for the variable names?

INSERT INTO Register (LastName, FirstName, EmployeeNumber, Email) VALUES ('::LastName::', '::FirstName::', '::EmployeeNumber::', '::Email::')


The variables are varLname  etc.  I don't see how these are carried over.
Okay all looks good so far so lets see if the problem is in page 3.

Comment out the redirect in page 3 like we did in page 2 and try submitting the information again.

What we should see on page 3 is the url passed from page 2 with all of the information like so:

http://www.xxxxxx.com/page3.asp?LastName=Smith&FirstName=Randall&EmployeeNumber=12112&Email=smithr@something.com

This will tell us that the data is in fact getting passed and let us know if we have any other errors being returned from the server.

On page two you have some additional code that is not required

<%
'Add additional fields as necessary
varLname = fp_rs("LastName")
varFname = fp_rs("FirstName")
varEmpNum = fp_rs("EmployeeNumber")
varEmail = fp_rs("Email")
%>
<tr>
               <td>
               <!--webbot bot="DatabaseResultColumn" s-columnnames="StudentID,EmployeeNumber,FirstName,LastName,Address,City,StateOrProvince,PostalCode,PhoneNumber,Major,Email,ThirdName,FourthName,Address1,Address2,Town,State,Zip,PhoneExtension" s-column="EmployeeNumber" b-tableformat="TRUE" b-hashtml="FALSE" b-makelink="FALSE" clientside b-MenuFormat preview="&lt;font size=&quot;-1&quot;&gt;&amp;lt;&amp;lt;&lt;/font&gt;EmployeeNumber&lt;font size=&quot;-1&quot;&gt;&amp;gt;&amp;gt;&lt;/font&gt;" startspan --><%=FP_FieldVal(fp_rs,"EmployeeNumber")%><!--webbot bot="DatabaseResultColumn" endspan i-checksum="41846" --></td>
          </tr>
          <!--webbot bot="DatabaseRegionEnd" b-tableformat="TRUE" b-menuformat="FALSE" u-dbrgn2="../_fpclass/fpdbrgn2.inc" i-groupsize="0" clientside tag="TBODY" preview="&lt;tr&gt;&lt;td colspan=64 bgcolor=&quot;#FFFF00&quot; width=&quot;100%&quot;&gt;&lt;font color=&quot;#000000&quot;&gt;This is the end of a Database Results region.&lt;/font&gt;&lt;/td&gt;&lt;/tr&gt;" startspan --><!--#include file="../_fpclass/fpdbrgn2.inc"-->
<!--webbot bot="DatabaseRegionEnd" endspan i-checksum="56926" --></tbody>
</table>


Should read:

<%
'Add additional fields as necessary
varLname = fp_rs("LastName")
varFname = fp_rs("FirstName")
varEmpNum = fp_rs("EmployeeNumber")
varEmail = fp_rs("Email")
%>

<!--webbot bot="DatabaseRegionEnd" b-tableformat="TRUE" b-menuformat="FALSE" u-dbrgn2="../_fpclass/fpdbrgn2.inc" i-groupsize="0" clientside tag="TBODY" preview="&lt;tr&gt;&lt;td colspan=64 bgcolor=&quot;#FFFF00&quot; width=&quot;100%&quot;&gt;&lt;font color=&quot;#000000&quot;&gt;This is the end of a Database Results region.&lt;/font&gt;&lt;/td&gt;&lt;/tr&gt;" startspan --><!--#include file="../_fpclass/fpdbrgn2.inc"-->
<!--webbot bot="DatabaseRegionEnd" endspan i-checksum="56926" --></
</tbody>
</table>

Delete starting with <tr> and ending with </tr> -- Just cleans it up and makes it easier to follow :-)
RCMB
These are carried over by the URL string

INSERT INTO Register (LastName, FirstName, EmployeeNumber, Email) VALUES ('::LastName::', '::FirstName::', '::EmployeeNumber::', '::Email::')

The variables are varLname  etc.  I don't see how these are carried over.

Your URL string states

LastName=" & varLname & "&....

What your query then looks for is what is in LastName so you insert would add to the database in the field LastName whatever was contained in the URL string for LastName.

RCMB
Avatar of dtolo

ASKER

The Url looks good.  Here is a sample:

http://zeusdev/cssd/prototype/ta/page3.asp?LastName=Crain&FirstName=Walter&EmployeeNumber=468646&Email=

(That record did not have an e-mail attached)  

The page reads:

Database Results Wizard Error
The operation failed. If this continues, please contact your server administrator.
 
Avatar of dtolo

ASKER

I tried using the wizard that allows to add a page that edits your SQL table, that seems to update fine, so I don't think it is a permissions issue.

Could it be that some of the fields may have nulls?  Eventually they won't  It is due to be cleaned up soon.
Okay this tells me you are using FP2003 running on IIS5.0 or older.

What we need to do is to repalce a few files on your webserver. With FrontPage open click on Tools, Web Settings, Parameters and check the box to display hidden files and folders. Say yes to refresh the site.

You will then see a directory name _fpclass, open this directory and export all the files in there to some place to protect them as we are going to replace them.

Here are two files you will need to copy them to notepad and then save them with the file names at the beginning of the code. Then copy them into the _fpclass directory and replace the existing files.

All should work then.

RCMB

fpdblib.inc

<%

Sub FP_SetLocaleForPage
    On Error Resume Next
    Session("FP_OldCodePage") = Session.CodePage
    Session("FP_OldLCID") = Session.LCID
    Err.Clear
    if FP_CodePage <> 0 then
        Session.CodePage = FP_CodePage
        if Err.Number <> 0 then Session.CodePage = Session("FP_OldCodePage")
    end if
    Err.Clear
    if FP_LCID <> 0 then
        Session.LCID = FP_LCID
        if Err.Number <> 0 then Session.LCID = Session("FP_OldLCID")
    end if
End Sub

Sub FP_RestoreLocaleForPage
    On Error Resume Next
    if Session("FP_OldCodePage") <> 0 then
        Session.CodePage = Session("FP_OldCodePage")
    end if
    if Session("FP_OldLCID") <> 0 then
        Session.LCID = Session("FP_OldLCID")
    end if
    Err.Clear
End Sub

Function FP_HTMLEncode(str)

    FP_HTMLEncode = str
    FP_HTMLEncode = Replace(FP_HTMLEncode,"&","^^@^^")
    FP_HTMLEncode = Server.HTMLEncode(FP_HTMLEncode)
    FP_HTMLEncode = Replace(FP_HTMLEncode,"^^@^^","&")

End Function

Function FP_FieldVal(rs, fldname)

    FP_FieldVal = FP_HTMLEncode(FP_Field(rs, fldname))
    if FP_FieldVal = "" then FP_FieldVal = "&nbsp;"

End Function

Function FP_Field(rs, fldname)

    If Not IsEmpty(rs) And Not (rs Is Nothing) and Not IsNull(rs(fldname)) Then
        Select Case rs(fldname).Type
            Case 128, 204, 205 ' adBinary, adVarBinary, adLongVarBinary
                FP_Field = "[#BINARY#]"
            Case 201, 203 ' adLongVarChar, adLongVarWChar
                if rs(fldname).DefinedSize > 255 then
                    ' check for Access hyperlink fields (only absolute http links)
                    fp_strVal = rs(fldname)
                    fp_idxHash1 = InStr(LCase(fp_strVal),"#http://")
                    if fp_idxHash1 > 0 then
                        fp_idxHash2 = InStr(fp_idxHash1+1,fp_strVal,"#")
                        if fp_idxHash2 > 0 then
                            ' this is an Access hyperlink; extract the URL part
                            fp_strVal = Mid(fp_strVal,fp_idxHash1+1)
                            if Right(fp_strVal,1) = "#" then
                                fp_strVal = Left(fp_strVal,Len(fp_strVal)-1)
                            end if
                        end if
                     end if
                     FP_Field = fp_strVal
                else
                     FP_Field = rs(fldname)
                end if
            Case Else
                FP_Field = rs(fldname)
        End Select
    Else
        FP_Field = ""
    End If

End Function

Function FP_FieldHTML(rs, fldname)

    FP_FieldHTML = FP_HTMLEncode(FP_Field(rs, fldname))

End Function

Function FP_FieldURL(rs, fldname)

    FP_FieldURL = Server.URLEncode(FP_Field(rs, fldname))

End Function

Function FP_FieldLink(rs, fldname)

    FP_FieldLink = Replace(FP_Field(rs, fldname), " ", "%20")

End Function

Sub FP_OpenConnection(oConn, sAttrs, sUID, sPWD, fMSAccessReadOnly)

     Dim sTmp
     Dim sConnStr
     Dim fIsAccessDriver

     fIsAccessDriver = (InStr(LCase(sAttrs), "microsoft access driver") > 0)
     sConnStr = FP_RemoveDriverWithDSN(sAttrs)
     sTmp = sConnStr
     
     On Error Resume Next

     If fMSAccessReadOnly And fIsAccessDriver Then

          sTmp = sTmp & ";Exclusive=1;ReadOnly=1"

          Err.Clear
          oConn.Open sTmp, sUID, sPWD
          If Err.Description = "" Then Exit Sub

     End If

     Err.Clear
     oConn.Open sConnStr, sUID, sPWD

End Sub

Function FP_RemoveDriverWithDSN(sAttrs)

     FP_RemoveDriverWithDSN = sAttrs

     sDrv = "driver="
     sDSN = "dsn="
     sLC = LCase(sAttrs)
     if InStr(sLC, sDSN) < 1 then exit function

     idxFirst = InStr(sLC, sDrv)
     if idxFirst < 1 then exit function
     idxBeg = idxFirst + Len(sDrv)
     if Mid(sLC,idxBeg,1) = "{" then
          idxEnd = InStr(idxBeg, sLC, "}")
          if idxEnd > 0 and Mid(sLC,idxEnd+1,1) = ";" then
               idxEnd = idxEnd + 1
          end if
     else
          idxEnd = InStr(idxBeg, sLC, ";")
     end if
     if idxEnd < 1 then idxEnd = Len(sLC)
     
     FP_RemoveDriverWithDSN = Left(sAttrs,idxFirst-1) & Mid(sAttrs,idxEnd+1)

End Function

Sub FP_OpenRecordset(rs)
     
     On Error Resume Next
     rs.Open

End Sub

Function FP_ReplaceQuoteChars(sQry)

     Dim sIn
     Dim sOut
     Dim idx

     sIn = sQry
     sOut = ""

     idx = InStr(sIn, "%%")

     Do While (idx > 0)

          sOut = sOut & Left(sIn, idx - 1)
          sIn = Mid(sIn, idx + 2)
          if (Left(sIn,1) = "%") And (Left(sIn,2) <> "%%") then
               sIn = Mid(sIn, 2)
               sOut = sOut & "%"
          end if
          sOut = sOut & "::"

          idx = InStr(sIn, "%%")
          if idx > 0 then
               sOut = sOut & Left(sIn, idx - 1)
               sIn = Mid(sIn, idx + 2)
               sOut = sOut & "::"
               if (Left(sIn,1) = "%") And (Left(sIn,2) <> "%%") then
                    sIn = Mid(sIn, 2)
                    sOut = sOut & "%"
               end if
          end if
         
          idx = InStr(sIn, "%%")

     Loop

     sOut = sOut & sIn

     FP_ReplaceQuoteChars = sOut

End Function

Sub FP_Close(obj)

     On Error Resume Next

     obj.Close

End Sub

Sub FP_SetCursorProperties(rs)

     On Error Resume Next

     rs.CursorLocation = 3 ' adUseClient
     rs.CursorType = 3 ' adOpenStatic

End Sub

%>

fpdbrgn1.inc


<%

FP_SetLocaleForPage

' determine whether or not to provide navigation controls
if fp_iPageSize > 0 then
     fp_fShowNavbar = True
else
     fp_fShowNavbar = False
end if

fp_sPagePath = Request.ServerVariables("PATH_INFO")
fp_sEnvKey = fp_sPagePath & "#fpdbr_" & fp_iRegion
fp_sFormName = "fpdbr_" & CStr(fp_iRegion)
fp_sFormKey = fp_sFormName & "_PagingMove"

fp_sInputs = fp_sDefault

fp_sFirstLabel = "  |<  "
fp_sPrevLabel  = "   <  "
fp_sNextLabel  = "  >   "
fp_sLastLabel  = "  >|  "
fp_sDashLabel  = "  --  "

if not IsEmpty(Request(fp_sFormKey)) then
     fp_sMoveType = Request(fp_sFormKey)
else
    fp_sMoveType = ""
end if

fp_iCurrent=1
fp_fError=False
fp_bBlankField=False
Set fp_dictInputs = Server.CreateObject("Scripting.Dictionary")

fp_sQry = FP_ReplaceQuoteChars(fp_sQry)

' replace any input parameters in query string
Do While (Not fp_fError) And (InStr(fp_iCurrent, fp_sQry, "::") <> 0)
     ' found a opening quote, find the close quote
     fp_iStart = InStr(fp_iCurrent, fp_sQry, "::")
     fp_iEnd = InStr(fp_iStart + 2, fp_sQry, "::")
     If fp_iEnd = 0 Then
          fp_fError = True
          Response.Write "<B>Database Results Error: mismatched parameter delimiters</B>"
     Else
          fp_sField = Mid(fp_sQry, fp_iStart + 2, fp_iEnd - fp_iStart - 2)
          fp_sValue = Request.Form(fp_sField)
          if len(fp_sValue) = 0 then fp_sValue = Request.QueryString(fp_sField)

          ' if the named form field doesn't exist, make a note of it
          If (len(fp_sValue) = 0) Then
               fp_iStartField = InStr(fp_sDefault, fp_sField & "=")
               if fp_iStartField > 0 then
                    fp_iStartField = fp_iStartField + len(fp_sField) + 1
                    fp_iEndField = InStr(fp_iStartField,fp_sDefault,"&")
                    if fp_iEndField > 0 then
                         fp_sValue = Mid(fp_sDefault,fp_iStartField,fp_iEndField - fp_iStartField)
                    else
                         fp_sValue = Mid(fp_sDefault,fp_iStartField)
                    end if
               end if
          End If

          ' remember names and values used in query
          if not fp_dictInputs.Exists(fp_sField) then
               fp_dictInputs.Add fp_sField, fp_sValue
          end if

          ' this next finds the named form field value, and substitutes in
          ' doubled single-quotes for all single quotes in the literal value
          ' so that SQL doesn't get confused by seeing unpaired single-quotes
          If (Mid(fp_sQry, fp_iStart - 1, 1) = """") Then
               fp_sValue = Replace(fp_sValue, """", """""")
          ElseIf (Mid(fp_sQry, fp_iStart - 1, 1) = "'") Then
               fp_sValue = Replace(fp_sValue, "'", "''")
          End If

          If (len(fp_sValue) = 0) Then fp_bBlankField = True

          fp_sQry = Left(fp_sQry, fp_iStart - 1) & fp_sValue & Right(fp_sQry, Len(fp_sQry) - fp_iEnd - 1)
         
          ' Fixup the new current position to be after the substituted value
          fp_iCurrent = fp_iStart + Len(fp_sValue)
     End If
Loop

' establish connection
If Not fp_fError Then
     if Application(fp_sDataConn & "_ConnectionString") = "" then
          Err.Description = "The database connection named '" & fp_sDataConn & "' is undefined.<br><br>"
          Err.Description = Err.Description & "This problem can occur if:<br>"
          Err.Description = Err.Description & "* the connection has been removed from the web<br>"
          Err.Description = Err.Description & "* the file 'global.asa' is missing or contains errors<br>"
          Err.Description = Err.Description & "* the root folder does not have Scripting permissions enabled<br>"
          Err.Description = Err.Description & "* the web is not marked as an Application Root<br>"
          fp_fError = True
     end if
     if Not fp_fError then
          set fp_conn = Server.CreateObject("ADODB.Connection")
          fp_conn.ConnectionTimeout = Application(fp_sDataConn & "_ConnectionTimeout")
          fp_conn.CommandTimeout = Application(fp_sDataConn & "_CommandTimeout")
          fp_sConn = Application(fp_sDataConn & "_ConnectionString")
          fp_sUid = Application(fp_sDataConn & "_RuntimeUserName")
          fp_sPwd = Application(fp_sDataConn & "_RuntimePassword")
          Err.Clear
          FP_OpenConnection fp_conn, fp_sConn, fp_sUid, fp_sPwd, Not(fp_fCustomQuery)
          if Err.Description <> "" then fp_fError = True
     end if
     if Not fp_fError then
          set fp_cmd = Server.CreateObject("ADODB.Command")
          fp_cmd.CommandText = fp_sQry
          fp_cmd.CommandType = fp_iCommandType
          set fp_cmd.ActiveConnection = fp_conn
          set fp_rs = Server.CreateObject("ADODB.Recordset")
          set fp_rs.Source = fp_cmd
          If fp_iCommandType = 4 Then
               fp_cmd.Parameters.Refresh
               Do Until Len(fp_sInputs) = 0
                    fp_iLoc = InStr(fp_sInputs,"=")
                    if fp_iLoc = 0 then exit do
                    fp_sKey = Left(fp_sInputs,fp_iLoc - 1)
                    fp_sInputs = Mid(fp_sInputs,fp_iLoc + 1)
                    fp_iLoc = InStr(fp_sInputs,"&")
                    if fp_iLoc = 0 then
                         fp_sInpVal = fp_sInputs
                         fp_sInputs = ""
                    else
                         fp_sInpVal = Left(fp_sInputs,fp_iLoc - 1)
                         fp_sInputs = Mid(fp_sInputs,fp_iLoc + 1)
                    end if              
                    fp_sVal = Request.Form(fp_sKey)
                    if len(fp_sVal) = 0 then fp_sVal = Request.QueryString(fp_sKey)
                    if len(fp_sVal) = 0 then fp_sVal = fp_sInpVal
                    fp_pType = fp_cmd.Parameters(fp_sKey).Type
                    select case fp_pType
                         case 129, 200, 201, 130, 202, 203 ' adChar, adVarChar, adLongVarChar, adWChar, adVarWChar, adLongVarWChar
                              fp_cmd.Parameters(fp_sKey).Size = Len(fp_sVal) + 1
                         case else
                              ' do nothing
                    end select

                    ' remember names and values used in query
                    if not fp_dictInputs.Exists(fp_sKey) then
                         fp_dictInputs.Add fp_sKey, fp_sVal
                    end if

                    fp_cmd.Parameters(fp_sKey) = fp_sVal
               Loop
          End If
          If fp_iMaxRecords <> 0 Then fp_rs.MaxRecords = fp_iMaxRecords

          FP_SetCursorProperties(fp_rs)

          FP_OpenRecordset(fp_rs)
     end if

     If Err.Description <> "" Then
          if fp_fTableFormat then
               Response.Write "<tr><td colspan=" & fp_iDisplayCols & " color=#000000 bgcolor=#ffff00>"
          end if
          Response.Write "<tt>"
          Response.Write "<b>Database Results Error</b><br>"
          if Not fp_fError then
               Response.Write "<i>Description:</i> " & Err.Description & "<br>"
               Response.Write "<i>Number:</i> " & Err.Number & " (0x" & Hex(Err.Number) & ")<br>"
               Response.Write "<i>Source:</i> " & Err.Source & "<br>"
          else
               Response.Write Err.Description
          end if
          if fp_bBlankField Then
               Response.Write "<br>One or more form fields were empty."
               Response.Write " You should provide default values for all form fields that are used in the query."
          End If
          Response.Write "</tt>"
          if fp_fTableFormat then
               Response.Write "</td></tr>"
          end if
          fp_fError = True
     Else
          ' Check for the no-record case
          if fp_rs.State <> 1 then
               fp_fError = True
               Response.Write fp_sNoRecords
          ElseIf fp_rs.EOF And fp_rs.BOF Then
               fp_fError = True
               Response.Write fp_sNoRecords
          end if
    end if
end if

' determine whether or not provider supports Absolute Positioning
if not fp_fError then
     if IsObject(fp_rs) and not(fp_rs.Supports(&H00004000)) then
          fp_iPageSize = 0
          fp_fShowNavbar = False
     end if
end if

' move to correct position in result set
if not fp_fError then

    if fp_iPageSize > 0 then
          fp_iAbsPage = 1
          fp_sVal = Session(fp_sEnvKey)
          if fp_sVal <> "" then
               fp_iAbsPage = CInt(fp_sVal)
          end if

          fp_rs.PageSize = fp_iPageSize
          if fp_iAbsPage > fp_rs.PageCount then fp_iAbsPage = fp_rs.PageCount
          fp_rs.AbsolutePage = fp_iAbsPage
          if fp_rs.PageCount = 1 then fp_fShowNavbar = False

          select case fp_sMoveType
               case ""
                    ' do nothing
               case fp_sFirstLabel
                    fp_rs.AbsolutePage = 1
               case fp_sPrevLabel
                    if fp_rs.AbsolutePage > 1 then fp_rs.AbsolutePage = fp_rs.AbsolutePage - 1
               case fp_sNextLabel
                    if fp_rs.AbsolutePage < fp_rs.PageCount then fp_rs.AbsolutePage = fp_rs.AbsolutePage + 1
               case fp_sLastLabel
                    fp_rs.AbsolutePage = fp_rs.PageCount
               case else
                    ' do nothing
          end select

          fp_iAbsPage = fp_rs.AbsolutePage
          Session(fp_sEnvKey) = fp_iAbsPage
    end if

end if

if fp_fError then fp_fShowNavbar = False

fp_iCount = 0
Do
    if fp_fError then exit do
    if fp_rs.EOF then exit do
    if fp_iPageSize > 0 And fp_iCount >= fp_rs.PageSize then exit do
    if fp_iMaxRecords > 0 And fp_iCount >= fp_iMaxRecords then
     ' MaxRecords didn't work; exit loop
     fp_fShowNavbar = False
     exit do
    end if
%>
The problem is a known issue with Microsoft and when you attempt to update a database containing numbers from a FP2003 generated site you will receive the error you are seeing. If you just copy the files from FP2002 all works fine.

RCMB
David -

If you need to verify the name prior to submission then we need to combine pages one and two which is much easier to work with.

Post the code from page one and two here and I will modify to make one page that will first display the drop down (employee number) and then on select display the users name information. Then when they click on submit it will post the data to page 3 and write to the database.

RCMB
Avatar of dtolo

ASKER

Wow!  Nice!

You did it!

Two more things (I will give you the points whether or not you can help me here.
You definately earned them)  Is it possible that when the number is selected the user
First and last name become visible so that they have a little more confidence submiting their
Entry?  

And secondly
(not as important as the previous request) Is it possible that once a certain amount of records
are submited, a message shows on the registration page saying that the class is full and provides
them a link to a differnt page?  Or how would you suggest handling full classes?
On the first item it is very easy so see the last note I posted.

For the second issue all we need to do is a record count. I am going to make an assumption that somewhere the data is stored as to what class they are registering for (hopefully in the register table).

What we will need to do on the second page is to create a database results wizard (do this before the other area) to do something like:

SELECT Count(EmpNum) AS RecCount WHERE CLASS='::Class::' and ClassDate=#::ClassDate::#

At the end of your database start region (like we did when we assigned the variables earlier) assign a new variable <% varRecCount = fp_rs("RecCount") %>

Then after the entire database results region and before the region that does the SELECT * FROM ... WHERE EmpNum = ::EmpNum:: do this

<% If varRecCount < 100 Then %>

do the select statement

<% Else %>

This class is full. Please click <a href="classrequest.htm">here</a> to return to the class request form page.

<% End if %>

Hopefully you get the idea.

R/RCMB
Avatar of dtolo

ASKER

Very Very Nice!

Thank you so much.  You make Frontpage much easier to use.

God Bless You

~David
Avatar of dtolo

ASKER

Hey you second guessed me.. I did'nt notice that you had allready sugested that.  :-)

Page 1


<html>

<head>
<% ' FP_ASP -- ASP Automatically generated by a Frontpage Component. Do not Edit.
FP_CharSet = "windows-1252"
FP_CodePage = 1252 %>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Register For Class</title>
</head>

<body>

<form action="page2.asp">
      <nobr>
      <!--webbot bot="DatabaseRegionStart" s-columnnames="StudentID,EmployeeNumber,FirstName,LastName,Address,City,StateOrProvince,PostalCode,PhoneNumber,Major,Email,ThirdName,FourthName,Address1,Address2,Town,State,Zip,PhoneExtension" s-columntypes="3,202,200,200,200,202,202,202,202,202,200,200,200,200,200,200,200,200,200" s-dataconnection="TA-UPDATE" b-tableformat="FALSE" b-menuformat="TRUE" s-menuchoice="EmployeeNumber" s-menuvalue="EmployeeNumber" b-tableborder="TRUE" b-tableexpand="TRUE" b-tableheader="TRUE" b-listlabels="TRUE" b-listseparator="TRUE" i-listformat="0" b-makeform="FALSE" s-recordsource="Students" s-displaycolumns="EmployeeNumber,LastName" s-criteria s-order="[EmployeeNumber] +" s-sql="SELECT * FROM Students ORDER BY EmployeeNumber ASC" b-procedure="FALSE" clientside suggestedext="asp" s-defaultfields s-norecordsfound="No records returned." i-maxrecords="0" i-groupsize="0" botid="0" u-dblib="../_fpclass/fpdblib.inc" u-dbrgn1="../_fpclass/fpdbrgn1.inc" u-dbrgn2="../_fpclass/fpdbrgn2.inc" preview=" &lt;span style=&quot;color: rgb(0,0,0); background-color: rgb(255,255,0)&quot;&gt;Database&lt;/span&gt; " b-InForm="TRUE" b-UseDotNET="FALSE" CurrentExt sa-InputTypes b-DataGridFormat="FALSE" b-DGridAlternate="TRUE" sa-CritTypes b-WasTableFormat="FALSE" startspan --><!--#include file="../_fpclass/fpdblib.inc"-->
<% if 0 then %>
<SCRIPT Language="JavaScript">
document.write("<div style='background: yellow; color: black;'>The Database Results component on this page is unable to display database content. The page must have a filename ending in '.asp', and the web must be hosted on a server that supports Active Server Pages.</div>");
</SCRIPT>
<% end if %>
<%
fp_sQry="SELECT * FROM Students ORDER BY EmployeeNumber ASC"
fp_sDefault=""
fp_sNoRecords="No records returned."
fp_sDataConn="TA-UPDATE"
fp_iMaxRecords=0
fp_iCommandType=1
fp_iPageSize=0
fp_fTableFormat=False
fp_fMenuFormat=True
fp_sMenuChoice="EmployeeNumber"
fp_sMenuValue="EmployeeNumber"
fp_sColTypes="&StudentID=3&EmployeeNumber=202&FirstName=200&LastName=200&Address=200&City=202&StateOrProvince=202&PostalCode=202&PhoneNumber=202&Major=202&Email=200&ThirdName=200&FourthName=200&Address1=200&Address2=200&Town=200&State=200&Zip=200&PhoneExtension=200&"
fp_iDisplayCols=2
fp_fCustomQuery=False
BOTID=0
fp_iRegion=BOTID
%>
<!--webbot bot="DatabaseRegionStart" endspan i-checksum="9407" --><select NAME="EmployeeNumber" SIZE="1">
      <!--webbot bot="AspInclude" clientside u-incfile="../_fpclass/fpdbrgn1.inc" startspan --><!--#include file="../_fpclass/fpdbrgn1.inc"--><!--webbot bot="AspInclude" endspan i-checksum="52766" -->
      <option><%=FP_FieldHTML(fp_rs,"EmployeeNumber")%></option>
      <!--webbot bot="AspInclude" clientside u-incfile="../_fpclass/fpdbrgn2.inc" startspan --><!--#include file="../_fpclass/fpdbrgn2.inc"--><!--webbot bot="AspInclude" endspan i-checksum="52830" -->
      </select><!--webbot bot="DatabaseRegionEnd" b-tableformat="FALSE" b-menuformat="TRUE" u-dbrgn2="../_fpclass/fpdbrgn2.inc" i-groupsize="0" clientside preview=" &lt;span style=&quot;color: rgb(0,0,0); background-color: rgb(255,255,0)&quot;&gt;Results&lt;/span&gt; " startspan --><!--webbot bot="DatabaseRegionEnd" endspan --><input type="submit" value="Submit" name="B1"></nobr></form>

</body>

</html>

Page 2

<html>

<head>
<% ' FP_ASP -- ASP Automatically generated by a Frontpage Component. Do not Edit.
FP_CharSet = "windows-1252"
FP_CodePage = 1252 %>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>New Page 1</title>
</head>

<body>

<table>
      <tbody>
            <!--webbot bot="DatabaseRegionStart" s-columnnames="StudentID,EmployeeNumber,FirstName,LastName,Address,City,StateOrProvince,PostalCode,PhoneNumber,Major,Email,ThirdName,FourthName,Address1,Address2,Town,State,Zip,PhoneExtension" s-columntypes="3,202,200,200,200,202,202,202,202,202,200,200,200,200,200,200,200,200,200" s-dataconnection="TA-UPDATE" b-tableformat="TRUE" b-menuformat="FALSE" s-menuchoice s-menuvalue b-tableborder="FALSE" b-tableexpand="FALSE" b-tableheader="FALSE" b-listlabels="TRUE" b-listseparator="TRUE" i-listformat="0" b-makeform="FALSE" s-recordsource="Students" s-displaycolumns="EmployeeNumber" s-criteria="[EmployeeNumber] EQ {EmployeeNumber} +" s-order s-sql="SELECT * FROM Students WHERE (EmployeeNumber =  '::EmployeeNumber::')" b-procedure="FALSE" clientside suggestedext="asp" s-defaultfields="EmployeeNumber=" s-norecordsfound="No records returned." i-maxrecords="0" i-groupsize="0" botid="0" u-dblib="../_fpclass/fpdblib.inc" u-dbrgn1="../_fpclass/fpdbrgn1.inc" u-dbrgn2="../_fpclass/fpdbrgn2.inc" tag="TBODY" preview="&lt;tr&gt;&lt;td colspan=64 bgcolor=&quot;#FFFF00&quot; width=&quot;100%&quot;&gt;&lt;font color=&quot;#000000&quot;&gt;This is the start of a Database Results region.&lt;/font&gt;&lt;/td&gt;&lt;/tr&gt;" startspan --><!--#include file="../_fpclass/fpdblib.inc"-->
<% if 0 then %>
<SCRIPT Language="JavaScript">
document.write("<div style='background: yellow; color: black;'>The Database Results component on this page is unable to display database content. The page must have a filename ending in '.asp', and the web must be hosted on a server that supports Active Server Pages.</div>");
</SCRIPT>
<% end if %>
<%
fp_sQry="SELECT * FROM Students WHERE (EmployeeNumber =  '::EmployeeNumber::')"
fp_sDefault="EmployeeNumber="
fp_sNoRecords="<tr><td colspan=1 align=""LEFT"" width=""100%"">No records returned.</td></tr>"
fp_sDataConn="TA-UPDATE"
fp_iMaxRecords=0
fp_iCommandType=1
fp_iPageSize=0
fp_fTableFormat=True
fp_fMenuFormat=False
fp_sMenuChoice=""
fp_sMenuValue=""
fp_sColTypes="&StudentID=3&EmployeeNumber=202&FirstName=200&LastName=200&Address=200&City=202&StateOrProvince=202&PostalCode=202&PhoneNumber=202&Major=202&Email=200&ThirdName=200&FourthName=200&Address1=200&Address2=200&Town=200&State=200&Zip=200&PhoneExtension=200&"
fp_iDisplayCols=1
fp_fCustomQuery=False
BOTID=0
fp_iRegion=BOTID
%>
<!--#include file="../_fpclass/fpdbrgn1.inc"-->
<!--webbot bot="DatabaseRegionStart" endspan i-checksum="50921" -->

<%
'Add additional fields as necessary
varLname = fp_rs("LastName")
varFname = fp_rs("FirstName")
varEmpNum = fp_rs("EmployeeNumber")
varEmail = fp_rs("Email")
%>
<tr>
                  <td>
                  <!--webbot bot="DatabaseResultColumn" s-columnnames="StudentID,EmployeeNumber,FirstName,LastName,Address,City,StateOrProvince,PostalCode,PhoneNumber,Major,Email,ThirdName,FourthName,Address1,Address2,Town,State,Zip,PhoneExtension" s-column="EmployeeNumber" b-tableformat="TRUE" b-hashtml="FALSE" b-makelink="FALSE" clientside b-MenuFormat preview="&lt;font size=&quot;-1&quot;&gt;&amp;lt;&amp;lt;&lt;/font&gt;EmployeeNumber&lt;font size=&quot;-1&quot;&gt;&amp;gt;&amp;gt;&lt;/font&gt;" startspan --><%=FP_FieldVal(fp_rs,"EmployeeNumber")%><!--webbot bot="DatabaseResultColumn" endspan i-checksum="41846" --></td>
            </tr>
            <!--webbot bot="DatabaseRegionEnd" b-tableformat="TRUE" b-menuformat="FALSE" u-dbrgn2="../_fpclass/fpdbrgn2.inc" i-groupsize="0" clientside tag="TBODY" preview="&lt;tr&gt;&lt;td colspan=64 bgcolor=&quot;#FFFF00&quot; width=&quot;100%&quot;&gt;&lt;font color=&quot;#000000&quot;&gt;This is the end of a Database Results region.&lt;/font&gt;&lt;/td&gt;&lt;/tr&gt;" startspan --><!--#include file="../_fpclass/fpdbrgn2.inc"-->
<!--webbot bot="DatabaseRegionEnd" endspan i-checksum="56926" --></tbody>
</table>
<% response.redirect "page3.asp?LastName=" & varLname & "&FirstName=" & varFname & "&EmployeeNumber=" & varEmpNum & "&Email=" & varEmail %>

<%=varLname%><br>
<%=varFname%><br>
<%=varEmpNum%><br>
<%=varEmail%>
</body>

</html>
Okay this may require a little tweaking but it should work. Replace all of page1.asp with this: (note you will no longer need page2.asp)


Here is what happens - You open page 1 and the form displays a drop down list of all employees, you select your number and the page reloads page 1 with the information corresponding to the number selected. If you click on yes the form submits your data to page3.asp and then writes the data and redirects you to wherever. Man I love a challenge!!! ;-)

<html>

<head>
<% ' FP_ASP -- ASP Automatically generated by a Frontpage Component. Do not Edit.
FP_CharSet = "windows-1252"
FP_CodePage = 1252 %>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Register For Class</title>
</head>

<body>
<% If request("Submit") <> "" Then %>

<table>
     <tbody>
          <!--webbot bot="DatabaseRegionStart" s-columnnames="StudentID,EmployeeNumber,FirstName,LastName,Address,City,StateOrProvince,PostalCode,PhoneNumber,Major,Email,ThirdName,FourthName,Address1,Address2,Town,State,Zip,PhoneExtension" s-columntypes="3,202,200,200,200,202,202,202,202,202,200,200,200,200,200,200,200,200,200" s-dataconnection="TA-UPDATE" b-tableformat="TRUE" b-menuformat="FALSE" s-menuchoice s-menuvalue b-tableborder="FALSE" b-tableexpand="FALSE" b-tableheader="FALSE" b-listlabels="TRUE" b-listseparator="TRUE" i-listformat="0" b-makeform="FALSE" s-recordsource="Students" s-displaycolumns="EmployeeNumber" s-criteria="[EmployeeNumber] EQ {EmployeeNumber} +" s-order s-sql="SELECT * FROM Students WHERE (EmployeeNumber =  '::EmployeeNumber::')" b-procedure="FALSE" clientside suggestedext="asp" s-defaultfields="EmployeeNumber=" s-norecordsfound="No records returned." i-maxrecords="0" i-groupsize="0" botid="0" u-dblib="../_fpclass/fpdblib.inc" u-dbrgn1="../_fpclass/fpdbrgn1.inc" u-dbrgn2="../_fpclass/fpdbrgn2.inc" tag="TBODY" preview="&lt;tr&gt;&lt;td colspan=64 bgcolor=&quot;#FFFF00&quot; align=&quot;left&quot; width=&quot;100%&quot;&gt;&lt;font color=&quot;#000000&quot;&gt;This is the start of a Database Results region. The region will not work unless the page has a file extension of &quot;.asp&quot;.&lt;/font&gt;&lt;/td&gt;&lt;/tr&gt;" startspan --><!--#include file="fpweb:///_fpclass/fpdblib.inc"-->
<% if 0 then %>
<SCRIPT Language="JavaScript">
document.write("<div style='background: yellow; color: black;'>The Database Results component on this page is unable to display database content. The page must have a filename ending in '.asp', and the web must be hosted on a server that supports Active Server Pages.</div>");
</SCRIPT>
<% end if %>
<%
fp_sQry="SELECT * FROM Students WHERE (EmployeeNumber =  '::EmployeeNumber::')"
fp_sDefault="EmployeeNumber="
fp_sNoRecords="<tr><td colspan=1 align=left width=""100%"">No records returned.</td></tr>"
fp_sDataConn="TA-UPDATE"
fp_iMaxRecords=0
fp_iCommandType=1
fp_iPageSize=0
fp_fTableFormat=True
fp_fMenuFormat=False
fp_sMenuChoice=""
fp_sMenuValue=""
fp_sColTypes="&StudentID=3&EmployeeNumber=202&FirstName=200&LastName=200&Address=200&City=202&StateOrProvince=202&PostalCode=202&PhoneNumber=202&Major=202&Email=200&ThirdName=200&FourthName=200&Address1=200&Address2=200&Town=200&State=200&Zip=200&PhoneExtension=200&"
fp_iDisplayCols=1
fp_fCustomQuery=False
BOTID=0
fp_iRegion=BOTID
%>
<!--#include file="fpweb:///_fpclass/fpdbrgn1.inc"-->
<!--webbot bot="DatabaseRegionStart" endspan i-checksum="61715" -->

<%
'Add additional fields as necessary
varLname = fp_rs("LastName")
varFname = fp_rs("FirstName")
varEmpNum = fp_rs("EmployeeNumber")
varEmail = fp_rs("Email")
%>
<tr>
      <td width="50%">Last Name</td>
      <td width="50%"><%=fp_rs("LastName")%></td>
</tr>
<tr>
      <td width="50%">First Name
      <td width="50%"><%=fp_rs("FirstName")%></td>
</tr>
<tr>
      <td width="50%">Employee Number
      <td width="50%"><%=fp_rs("EmployeeNumber")%></td>
</tr>
<tr>
      <td width="50%">Email Address
      <td width="50%"><%=fp_rs("Email")%></td>
</tr>
<tr>
      <td width="100%" colspan="2" align="center">Is this information correct?</td>
</tr>
<!--webbot bot="DatabaseRegionEnd" b-tableformat="TRUE" b-menuformat="FALSE" u-dbrgn2="../_fpclass/fpdbrgn2.inc" i-groupsize="0" clientside tag="TBODY" preview="&lt;tr&gt;&lt;td colspan=64 bgcolor=&quot;#FFFF00&quot; align=&quot;left&quot; width=&quot;100%&quot;&gt;&lt;font color=&quot;#000000&quot;&gt;This is the end of a Database Results region.&lt;/font&gt;&lt;/td&gt;&lt;/tr&gt;" startspan --><!--#include file="fpweb:///_fpclass/fpdbrgn2.inc"-->
<!--webbot bot="DatabaseRegionEnd" endspan i-checksum="23298" --></tbody>
</table>
<table align="center">
      <tr>
            <td>
<form action="page3.asp">
<input type="hidden" value="<%=varLname%>" name="LastName">
<input type="hidden" value="<%=varFname%>" name="FirstName">
<input type="hidden" value="<%=varEmpNum%>" name="EmployeeNumber">
<input type="hidden" value="<%=varEmail%>" name="Email">
<input type="submit" value="Yes - Continue With Registraton" name="SubmitReg">
</form>
            </td>
            <td>
<form action="javascript:history.go(-1)">
<input type="submit" value="No - Return to Selection Form" name="Return">
</form>
            </td>
</tr>
</table>

<% Else %>
<form action="page1.asp">
     <nobr>
     <!--webbot bot="DatabaseRegionStart" s-columnnames="StudentID,EmployeeNumber,FirstName,LastName,Address,City,StateOrProvince,PostalCode,PhoneNumber,Major,Email,ThirdName,FourthName,Address1,Address2,Town,State,Zip,PhoneExtension" s-columntypes="3,202,200,200,200,202,202,202,202,202,200,200,200,200,200,200,200,200,200" s-dataconnection="TA-UPDATE" b-tableformat="FALSE" b-menuformat="TRUE" s-menuchoice="EmployeeNumber" s-menuvalue="EmployeeNumber" b-tableborder="TRUE" b-tableexpand="TRUE" b-tableheader="TRUE" b-listlabels="TRUE" b-listseparator="TRUE" i-listformat="0" b-makeform="FALSE" s-recordsource="Students" s-displaycolumns="EmployeeNumber,LastName" s-criteria s-order="[EmployeeNumber] +" s-sql="SELECT * FROM Students ORDER BY EmployeeNumber ASC" b-procedure="FALSE" clientside suggestedext="asp" s-defaultfields s-norecordsfound="No records returned." i-maxrecords="0" i-groupsize="0" botid="1" u-dblib="../_fpclass/fpdblib.inc" u-dbrgn1="../_fpclass/fpdbrgn1.inc" u-dbrgn2="../_fpclass/fpdbrgn2.inc" preview=" &lt;span style=&quot;color: rgb(0,0,0); background-color: rgb(255,255,0)&quot;&gt;Database&lt;/span&gt; " b-InForm="TRUE" b-UseDotNET="FALSE" CurrentExt sa-InputTypes b-DataGridFormat="FALSE" b-DGridAlternate="TRUE" sa-CritTypes b-WasTableFormat="FALSE" startspan --><!--#include file="fpweb:///_fpclass/fpdblib.inc"-->
<% if 0 then %>
<SCRIPT Language="JavaScript">
document.write("<div style='background: yellow; color: black;'>The Database Results component on this page is unable to display database content. The page must have a filename ending in '.asp', and the web must be hosted on a server that supports Active Server Pages.</div>");
</SCRIPT>
<% end if %>
<%
fp_sQry="SELECT * FROM Students ORDER BY EmployeeNumber ASC"
fp_sDefault=""
fp_sNoRecords="No records returned."
fp_sDataConn="TA-UPDATE"
fp_iMaxRecords=0
fp_iCommandType=1
fp_iPageSize=0
fp_fTableFormat=False
fp_fMenuFormat=True
fp_sMenuChoice="EmployeeNumber"
fp_sMenuValue="EmployeeNumber"
fp_sColTypes="&StudentID=3&EmployeeNumber=202&FirstName=200&LastName=200&Address=200&City=202&StateOrProvince=202&PostalCode=202&PhoneNumber=202&Major=202&Email=200&ThirdName=200&FourthName=200&Address1=200&Address2=200&Town=200&State=200&Zip=200&PhoneExtension=200&"
fp_iDisplayCols=2
fp_fCustomQuery=False
BOTID=1
fp_iRegion=BOTID
%>
<!--webbot bot="DatabaseRegionStart" endspan i-checksum="27137" --><select NAME="EmployeeNumber" SIZE="1">
     <!--webbot bot="AspInclude" clientside u-incfile="../_fpclass/fpdbrgn1.inc" startspan --><!--#include file="../_fpclass/fpdbrgn1.inc"--><!--webbot bot="AspInclude" endspan i-checksum="52766" -->
     <option><%=FP_FieldHTML(fp_rs,"EmployeeNumber")%></option>
     <!--webbot bot="AspInclude" clientside u-incfile="../_fpclass/fpdbrgn2.inc" startspan --><!--#include file="../_fpclass/fpdbrgn2.inc"--><!--webbot bot="AspInclude" endspan i-checksum="52830" -->
     </select><!--webbot bot="DatabaseRegionEnd" b-tableformat="FALSE" b-menuformat="TRUE" u-dbrgn2="../_fpclass/fpdbrgn2.inc" i-groupsize="0" clientside preview=" &lt;span style=&quot;color: rgb(0,0,0); background-color: rgb(255,255,0)&quot;&gt;Results&lt;/span&gt; " startspan --><!--webbot bot="DatabaseRegionEnd" endspan -->
     <input type="submit" value="Submit" name="Submit"></nobr></form>
<% End if %>
</body>

</html>
Avatar of dtolo

ASKER

Very Nice!

You are the guru!

Thanks Again!

~David
Avatar of dtolo

ASKER

I really appreciate this code, this is great!
glad all is working. if you need more help let me know.

R/Curtis
Avatar of dtolo

ASKER

RCMB,

I wondered if you interested in tweeking this page or extending it.

I have asked a new question here:

https://www.experts-exchange.com/questions/21088182/Question-Continued-from-previous-class-registration-question.html

Let me know.

Thanks Again
~David