bertiefritz
Nov 21st, 2000, 06:19 AM
Hi
I have an asp page that connects to a database on load and displays the first recordset in a table, using
<%
set rs = server.createobject("adodb.recordset")
sSQL = "qryContactDetails"
sConn = "DSN=pubsource;UID=sa;PWD=12345"
rs.open sSQL, sConn
%>
I then want to be able to move through the records, add, delete and amend via clicking on buttons - using -
<SCRIPT LANGUAGE="VBScript">
Sub btnFirst_onClick
If rs.BOF = false Then
rs.movefirst
End If
End sub
Sub btnPrev_OnClick
If rs.BOF = false Then
rs.moveprevious
End If
End Sub
Sub btnNext_OnClick
rs.open sSQL, sConn
If rs.EOF = false Then
rs.movenext
End If
End Sub
Sub btnLast_onClick
If rs.EOF = false Then
rs.movelast
End If
End sub
</SCRIPT>
<div id="Layer4" style="position:absolute; left:85px; top:418px; width:664px; height:44px; z-index:5">
<form name="form1" >
<input type="button" name="btnFirst" value="First Record">
<input type="button" name="btnPrev" value="Previous Record">
<input type="button" name="btnNext" value="Next Record">
<input type="button" name="btnLast" value="Last Record">
<input type="button" name="Print" value="Print">
</form>
</div>
Whenever I click on a button I get 'object required 'rs''
I presume this is because I've lost the connection or it's no longer recognised.
How do I get round this - either by keeping the connection open or reopening it?
TIA
I have an asp page that connects to a database on load and displays the first recordset in a table, using
<%
set rs = server.createobject("adodb.recordset")
sSQL = "qryContactDetails"
sConn = "DSN=pubsource;UID=sa;PWD=12345"
rs.open sSQL, sConn
%>
I then want to be able to move through the records, add, delete and amend via clicking on buttons - using -
<SCRIPT LANGUAGE="VBScript">
Sub btnFirst_onClick
If rs.BOF = false Then
rs.movefirst
End If
End sub
Sub btnPrev_OnClick
If rs.BOF = false Then
rs.moveprevious
End If
End Sub
Sub btnNext_OnClick
rs.open sSQL, sConn
If rs.EOF = false Then
rs.movenext
End If
End Sub
Sub btnLast_onClick
If rs.EOF = false Then
rs.movelast
End If
End sub
</SCRIPT>
<div id="Layer4" style="position:absolute; left:85px; top:418px; width:664px; height:44px; z-index:5">
<form name="form1" >
<input type="button" name="btnFirst" value="First Record">
<input type="button" name="btnPrev" value="Previous Record">
<input type="button" name="btnNext" value="Next Record">
<input type="button" name="btnLast" value="Last Record">
<input type="button" name="Print" value="Print">
</form>
</div>
Whenever I click on a button I get 'object required 'rs''
I presume this is because I've lost the connection or it's no longer recognised.
How do I get round this - either by keeping the connection open or reopening it?
TIA