VBScript Sample: vbscript/ado/animals/animals.asp
   ASP Script
   Comments or Client-side Script
   HTML and Text

<%@ Language=VBScript %>
<HTML>
<HEAD></HEAD>
<BODY>
<%
   dbms = Request.QueryString("dbms")
   set RS = Session("animalsRd")
   direction = CInt( Request.QueryString("direction") )
   If RS.RecordCount > 0 then
      movecnt = Request.QueryString("movecnt")
      select case direction
         case 1:
            RS.MoveFirst
            movecnt = 1
         case 2:
            If not RS.BOF Then
               RS.MovePrevious
               movecnt = movecnt - 1
            End If
         case 3:
            If not RS.EOF Then
               RS.MoveNext
               movecnt = movecnt + 1
            End If
         case 4:
            RS.MoveLast
            movecnt = RS.RecordCount
         case else
            RS.CancelUpdate
      end select

      ' Error Handling
      If RS.EOF Then
         movecnt = RS.RecordCount
         RS.MoveLast
      End If

      If RS.BOF Then
         movecnt = 1
         RS.MoveFirst
      End If
   else
      movecnt = 0
   End If
%>

<FORM Method=post Name=form1>
<TABLE width=100%>
<%
   Set fieldInfo = RS.Fields
   for i = 0 to fieldInfo.Count - 2
      Set field = fieldInfo.Item(i)
%>

<TR><TD align=center width=40%><%=field.Name%>:</TD>
<TD width=60%>
<% 
      If RS.EOF or RS.BOF then
%>

<Input Type=Text name="Text<%=i%>" size=25>
<%
      else
%>

<Input Type=Text name="Text<%=i%>" size=25 Value="<%=field.Value%>">
<%
      end if
%>

</TD></TR>
<%
   Next
%>

</TABLE>

<CENTER><P>
<input type=button name=MoveFirst value=" |< " onClick="MoveClick(1);">
<input type=button name=MovePrevious value=" < " onClick="MoveClick(2);">
<INPUT Type=button Name=absolute Value=" <%=movecnt%> of <%=RS.RecordCount%> ">
<input type=button name=MoveNext value=" > " onClick="MoveClick(3);">
<input type=button name=MoveLast value=" >| " onClick="MoveClick(4);">
<INPUT Type=button Name=AddNew value="Add" onclick="AddRecord()"></P>
</CENTER>
</FORM>

<%if direction > 0 then%>
<SCRIPT language=javascript>
   parent.blob.location.reload();
</SCRIPT>

<%end if%>
<hr size="1" color="#000000">
<EM>This is <%=dbms%> database.</EM>
<font size="+1">
<center><a href="selectdb.asp" target=main>
Return Home</a></center></font>
</BODY>

<SCRIPT Language="JavaScript">
function MoveClick(option) {
   document.form1.action = "animals.asp?dbms=<%=dbms%>&movecnt=<%=movecnt%>&direction=" + option;
   document.form1.submit();
}
function AddRecord(){
   document.form1.action = "register.asp?dbms=<%=dbms%>&movecnt=<%=movecnt%>&chggif=0";
   document.form1.target = "main";
   document.form1.submit();
}
</SCRIPT>

</HTML>


Copyright © 1998-2002, Halcyon Software Inc. All rights reserved.