|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
||||
|
||||
|
Displaying next record from database
Hello everyone. I recently created an Access database which contains several columns of information. I've created asp files that extract the information from my Access database and place them into my asp file. However, I've discovered that making asp files for each row (or ID number) is very tedious and can be a pain when it comes to adding something new (such as a new column) because I have to go back and add the new column into each asp file. The following is the code of the first asp file:
<% @ LANGUAGE = VBScript %> <% Option Explicit %> <% Response.Buffer = True %> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=windows-1252"> <title>achem 1</title> </head> <body> <% Dim rs Set rs = Server.CreateObject ("ADODB.Recordset") rs.Open "SELECT * FROM info WHERE ID=1;", "DSN=achem" ' rs.Open "SELECT tool_type, ' forward, backward FROM info WHERE ID=1;", "DSN=achem" %> <% Const ForReading = 1 Const Create = False ' Filename = "descriptions\Dispenser Desc PQH2398.txt" Dim objFSO, TS, strLine, strFileName strFileName = Server.MapPath(rs("descriptions")) Set objFSO = Server.CreateObject("Scripting.FileSystemObject") Set TS = objFSO.OpenTextFile(strFileName, ForReading, Create) %> <table border='0' width="648" cellspacing='0' cellpadding='0'> <tr> <td width=50%><font face="Arial" size="2"><img border="0" src="<% =rs("pictures") %>"></font></td> <td width=50%><font face="Arial" size="2"> <% If Not TS.AtEndOfStream Then Do While Not TS.AtendOfStream strLine = TS.ReadLine Response.Write strLine Response.Write "<br>" Loop End If TS.Close Set TS = Nothing Set objFSO = Nothing %></font> </td> </tr> </table> <hr width="648" noshade size="1" align="left" color="#000000"> <table border='0' width="648" cellspacing='0' cellpadding='0'> <tr> <td width=50%> <table border="0" width="300" cellspacing="0" cellpadding="0"> <tr> <td width="50%"><font face="Arial" size="2">Tool Type:</font></td> <td width="50%"><font size="2" face="Arial"><% =rs("tool_type")%></font></td> </tr> </table> </td> </tr> </table> <p><font size="2" face="Arial"><a href="<% =rs("forward") %>">next ></a></font></p> </body> <% rs.Close Set rs = Nothing %> What I'd like for this to do, is when the user clicks next on the page, it takes them to "ID 2" in the database but still uses this asp outline to display it. That way I don't have to have an asp file for each row. So I'm trying to get the ID to change automatically. I don't know if there is some template that will do this or maybe I need to use some code in VBScript to do this. If someone could give me some pointers on what I can do, I'd really appreciate it. Thank you |
|
#2
|
|||
|
|||
|
I would post this question in the ASP forum. Most here just work in Access only
S- |
|
#3
|
||||
|
||||
|
I thought this was the asp forum?
|
|
#4
|
|||
|
|||
|
You want the part of the forum that is ASP Coding
Most of the people in the part deal strickly with Access Coding (VBA) S- |
![]() |
| Viewing: ASP Free Forums > Database > Microsoft Access Help > Displaying next record from database |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|