RE: What's can be wrong here? - 7/26/2001 20:18:00
Here is the rest of the code:' This get info from a previous form <% FirstName=request.form("FirstName") LastName=request.form("LastName") Location=request.form("Location") City=request.form("City") State=request.form("State") YearBox=request.form("YearBox") ' this code opens the the db set conntemp=server.createobject("adodb.connection") myconnect ="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.Mappath("\fpdb\pfdb1.mdb") & ";" conntemp.Open myconnect ' this code retrieves the ID number from table UserDB assigned by Access ' based on a unique user email and assigns it to "UserID" sqltemp="select * from UserDB where EmailAddress='" sqltemp=sqltemp & Session("UserEmail") & "'" set rstemp=conntemp.execute(sqltemp) Session("UserID")=rstemp("UserID") ' this code adds the info from the previous form into the Locations table plus ' the UserID from UserDB table, that way you can have a single user with many locations sqltemp="Insert Into Locations (UserID, FirstName, LastName, Location, L1City, L1State, L1Year) Values ("&Session("UserID")&", '"&FirstName&"', '"&LastName&"', '"&Location&"', '"&City&"', '"&State&"', '"&YearBox&"')" set rstemp=conntemp.execute(sqltemp) ' close the db connection set rstemp=nothing set conntemp=nothing %> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=windows-1252"> <meta http-equiv="Content-Language" content="en-us"> <title>Add Next</title> <meta name="GENERATOR" content="Microsoft FrontPage 4.0"> <meta name="ProgId" content="FrontPage.Editor.Document"> <meta name="Microsoft Theme" content="globalbusiness1 010, default"> </head> ' this code reopens the db <% set conntemp=server.createobject("adodb.connection") myconnect ="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.Mappath("\fpdb\pfdb1.mdb") & ";" conntemp.Open myconnect ' this code should grab the record(s) from the table Locations based on "UserID" from above ' and checks if no records are found sqltemp="select * from Locations where UserID=" sqltemp=sqltemp & Session("UserID") & "" set rstemp=conntemp.execute(sqltemp) if rstemp.eof then response.write "No records found<br>" response.write sqltemp & "<br>So cannot make table..." conntemp.close set conntemp=nothing response.end end if %> Locations you currently added.</font> </p> <!--mstheme--></font><table width="100%" border="0"> <thead> <tr> <td><!--mstheme--><font face="Arial, Arial, Helvetica"><b><font size="2">Location</font></b><!--mstheme--></font></td> <td><!--mstheme--><font face="Arial, Arial, Helvetica"><b><font size="2">City</font></b><!--mstheme--></font></td> <td><!--mstheme--><font face="Arial, Arial, Helvetica"><b><font size="2">State</font></b><!--mstheme--></font></td> <td><!--mstheme--><font face="Arial, Arial, Helvetica"><b><font size="2">Year</font></b><!--mstheme--></font></td> </tr> </thead> <tbody> ' finally, this code creates the table to display the record(s) <% do until rstemp.eof tempLocation=rstemp("Location") tempCity=rstemp("L1City") tempState=rstemp("L1State") tempYear=rstemp("L1Year") cellstart="<td align=""top"">" response.write "<tr>" response.write cellstart & tempLocation & "</td>" response.write cellstart & tempCity & "</td>" response.write cellstart & tempState & "</td>" response.write cellstart & tempYear & "</td>" response.write "</tr>" rstemp.movenext loop %> </table><!--mstheme--><font face="Arial, Arial, Helvetica"> ' close the connection <% set rstemp=nothing set conntemp=nothing %> </html>
|