Click to See Complete Forum and Search --> : next button??


al_3asel
05-12-2004, 04:51 AM
hi all,

I created a view page to display all records of the database

but unforetunetly I didn't achieve that. I suggest to make a "next" button but really I don't know how

the code is here
______________________

<HTML><HEAD>


<%
'Dimension variables
Dim adoCon 'Holds the Database Connection Object
Dim rsDb1 'Holds the recordset for the records in the database
Dim strSQL 'Holds the SQL query to query the database
'Create an ADO connection object
Set adoCon = Server.CreateObject("ADODB.Connection")
'Set an active connection to the Connection object using a DSN-less connection
adoCon.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("wardialer.mdb")
'Set an active connection to the Connection object using DSN connection
'Create an ADO recordset object
Set rsDb1 = Server.CreateObject("ADODB.Recordset")
'Initialise the strSQL variable with an SQL statement to query the database
strSQL = "SELECT table1.* FROM table1;"
'Open the recordset with the SQL query
rsDb1.Open strSQL, adoCon'Loop through the recordset
If (rsDb1.BOF or rsDb1.EOF) Then
Response.Write "No records retrieved."
End If


%>


</HEAD>
<BODY bgColor=#3366cd>


<P align=center><font
color=#ffffff>Please verify if all your info you supplied is correct! If not hit
back and correct.</font></P>



<center>
<table border="1" cellpadding="2" cellspacing="3" width="400">

<tr>
<td ><font face="Verdana" size="2" color=#ffffff>ModemNo :</font></td>
<td ><%=rsDb1("ModemNo")%>&nbsp;</td>
</tr>
<tr>
<td ><font face="Verdana" size="2" color=#ffffff>DeptCode :</font></td>
<td ><%=rsDb1("DeptCode")%>&nbsp;</td>
</tr>
<tr>
<td ><font face="Verdana" size="2" color=#ffffff>DeptName :</font></td>
<td ><%=rsDb1("DeptName")%>&nbsp;</td>
</tr>
<tr>
<td ><font face="Verdana" size="2" color=#ffffff>CSLNo :</font></td>
<td ><%=rsDb1("CSLNo")%>&nbsp;</td>
</tr>

<tr>
<td ><font face="Verdana" size="2" color=#ffffff>Area :</font></td>
<td ><%=rsDb1("Area")%>&nbsp;</td>
</tr>

<tr>
<td ><font face="Verdana" size="2" color=#ffffff>SiteName :</font></td>
<td ><%=rsDb1("SiteName")%>&nbsp;</td>
</tr>

<tr>
<td ><font face="Verdana" size="2" color=#ffffff>SiteNo :</font></td>
<td ><%=rsDb1("SiteNo")%>&nbsp;</td>
</tr>


<tr>
<td ><font face="Verdana" size="2" color=#ffffff>NC :</font></td>
<td ><%=rsDb1("NC")%>&nbsp;</td>
</tr>
<tr>
<td ><font face="Verdana" size="2" color=#ffffff>CT :</font></td>
<td ><%=rsDb1("CT")%>&nbsp;</td>
</tr>
<tr>
<td ><font face="Verdana" size="2" color=#ffffff>IC :</font></td>
<td ><%=rsDb1("IC")%>&nbsp;</td>
</tr>
<tr>
<td ><font face="Verdana" size="2" color=#ffffff>BU :</font></td>
<td ><%=rsDb1("BU")%>&nbsp;</td>
</tr>
<tr>
<%
'Reset server objects
rsDb1.Close
Set rsDb1 = Nothing
Set adoCon = Nothing
%>
</table>
</center>
</BODY></HTML>
_______________________________

plz I need your help
by posting the fit code.
thanks

buntine
05-12-2004, 05:13 AM
Your going to have to elaborate a bit... What do you mean by a 'next' button?

What is your desired result?

al_3asel
05-12-2004, 05:19 AM
when the user press next button the next record of the database will be displayed and so on

I want to do this to display all records of the database

buntine
05-12-2004, 05:54 AM
You will need to send each page a queryString variable and then use this variable in conjunction with SQL.

'| Get queryString variable.
Dim intRec
intRec = CInt(Request.QueryString("id"))

'|Construct SQL query.
sql = "SELECT * FROM table1 WHERE id = " & intRec

'|Write next button.
Response.Write ("<form action=""" & Split(Request.ServerVariables("SCRIPT_NAME"), "?")(0) & """ method=""get"" name=""nextPage"">" & vbCrLf)
Response.Write ("<input type=""submit"" name=""id"" value=""" & (intRec + 1) & """ />" & vbCrLf)
Response.Write ("</form>")

Above i have given examples of the three thing you will need to do.

You will need to have an ID field in your table which is of type 'autonumber', or atleast numeric.

Regards,
Andrew Buntine.