dbReset

Reset the following data of the unit:

GridPtr Grid pointer
FormPtr Form pointer
Querstring Variable  
aspEditBut  
aspDBSchemaSelectBoxItem  
aspDBGridSelectBoxItem  
gridSort FieldName sort
FormCol 1
GrdiCol 1
Filter SQL  
PageSize GridInc
Sort Direction ASC
DisplayLookup  
GridSelect  

During ASPdb programming, sometime it is necessary to clear all the system variables especially during the re-entrance of the same module. That means instead of flowing from one module to the next, the program logic calls for using the same module by modifying some of the properties. Note that all the variables of the modules are separated by the unit number. Therefore, it is not necessary to reset if a different unit number is used !

Property Syntax

Obj.dbReset(Unit)

Example

Run Reset-1.asp and select a country. The submit button will pass the country to the Reset-2.asp to build the query.

File = Reset-1.asp

<HTML>
<HEAD><title>ASP-db NWIND reset bug 1 </title></HEAD>
<FORM NAME=THEFORM ACTION="reset-2.asp?Reset=1" METHOD=POST>
Enter a Country <BR>
<SELECT NAME="SQLName">
<OPTION VALUE="USA">USA
<OPTION VALUE="UK">UK
</SELECT>
<INPUT TYPE=SUBMIT VALUE="Submit this Query">
</BODY>
</HTML>

File = Reset-2.asp

<HEAD><title>ASP-db2000 NWIND dbReset Demo </title></HEAD>
<%
W=Request("SQLName") ' Get what the user type in during the sql1 program
if (W <> "") then ' Is this the first time in? If so, set the session
Session("SesSQLName") = W ' variable so the user's entry will be remembered.
end if
LOCALSQL = Session("SesSQLName") + "%" ' Add the wildcard character.
Set X = Server.CreateObject("ASP.DB")
X.dbUnit = 10051
X.dbDSN = "NWIND"
X.dbMode = "Both"
SQ = "Select LastName,FirstName,Country FROM Employees "
SQ = SQ & " WHERE Country Like '" & LOCALSQL & "'"
X.dbSQL = SQ
X.dbNavigation="top"
X.dbNavigationItem="top, bottom, next, prev, reload"
if (Request("Reset") = "1") then
X.dbReset(10051) ' new parameters just came in.
end if
X.ASPDB
%>
<A HREF=reset-1.asp> reset-1.asp </A>
</BODY>
</HTML>