Results 1 to 3 of 3

Thread: dbreset?

  1. #1
    Paul Guest

    dbreset?

    Here is the jist of my problem.

    I have constructed my own search engine and it gives the user the option of filtering the data. If a search comes back with more than 10 records, clicking on the Next button does not give the correct results. Pressing the Previous button doesn't come close to getting the original results returned. I have used many variations of the dbreset w/o any luck. Below I have included the code for the results. The '*** comments are about the dbreset code tried. What I am I doing wrong?? Thanks in advance.

    <% @ Language=VBScript %>
    <!-- #include file=&#34;../../includethis.inc&#34;-->
    <% checkcookee() %>
    <% Response.Buffer = True %>

    <!-- * Page Function - Display Search Results in Table * -->

    <HTML>
    <HEAD>
    <TITLE>Search Results</TITLE></HEAD>

    <SCRIPT LANGUAGE=&#34;JavaScript&#34;>
    function again() {
    document.location=&#34;search.asp&#34;
    }

    function visitSite() {
    document.location=&#34;../default.asp&#34;
    }
    </SCRIPT>
    </HEAD>


    <BODY ALINK=&#34;Red&#34; VLINK=&#34;Navy&#34; LINK=&#34;Blue&#34; bgcolor=&#34;White&#34;>

    <div align=&#34;center&#34;><h2>Query Results</h2></div>
    <hr>

    <%

    Session( &#34;searchword&#34; ) = request.form(&#34;searchword&#34
    Session( &#34;searchword1&#34; ) = request.form(&#34;searchword1&#34
    Session( &#34;cat&#34; ) = request.form(&#34;category&#34
    Session( &#34;type1&#34; ) = request.form(&#34;testtype&#34
    Session( &#34;person&#34; ) = request.form(&#34;username&#34


    &#39; *** from the dbreset example -using this made the Next button display nothing
    &#39;If (Session( &#34;searchword&#34; ) <> &#34;&#34; Or Session( &#34;searchword1&#34; ) <> &#34;&#34; Or Session( &#34;cat&#34; ) <> &#34;&#34; Or Session( &#34;type1&#34; ) <> &#34;&#34; Or Session( &#34;person&#34; ) <> &#34;&#34; ) then

    &#39; Create the ASP-db object:
    Set MyDb = Server.CreateObject(&#34;ASPdb.Pro&#34
    &#39; Use YourFile.mdb in the current directory:
    MyDb.dbDSN = &#34;K_base&#34;

    MyDb.dbUnit=102

    SQL = &#34;Select main.id, main.problem, type.type_name, category.cat_name, employees.last_name FROM Main, Type, Category, Employees WHERE (&#34;
    If (Session( &#34;searchword&#34; ) <> &#34;&#34; ) then
    SQL = SQL + &#34; main.problem Like &#39;%&#34; + Session( &#34;searchword&#34; ) + &#34;%&#39; AND&#34;
    End If
    If (Session( &#34;searchword1&#34; ) <> &#34;&#34; ) then
    SQL = SQL + &#34; main.symptoms Like &#39;%&#34; + Session( &#34;searchword1&#34; ) + &#34;%&#39; AND&#34;
    End If
    If (Session( &#34;cat&#34; ) <> &#34;&#34; ) then
    SQL = SQL + &#34; main.category = &#34; + Session( &#34;cat&#34; ) + &#34; AND&#34;
    End If
    If (Session( &#34;type1&#34; ) <> &#34;&#34; ) then
    SQL = SQL + &#34; main.type = &#34; + Session( &#34;type1&#34; ) + &#34; AND&#34;
    End If
    If (Session( &#34;person&#34; ) <> &#34;&#34; ) then
    SQL = SQL + &#34; main.username = &#34; + Session( &#34;person&#34; ) + &#34; AND&#34;
    End If
    SQL = SQL + &#34; main.type = type.type_id AND main.category = category.cat_id AND main.username = employees.emp_id &#34;
    SQL = SQL + &#34&#34;


    &#39; ***** from the dbreset example
    If (request.form(&#34;searchword&#34 <> &#34;&#34; Or request.form(&#34;searchword1&#34 <> &#34;&#34; Or request.form(&#34;category&#34 <> &#34;&#34; Or request.form(&#34;testtype&#34 <> &#34;&#34; Or request.form(&#34;username&#34 <> &#34;&#34; ) then
    Mydb.dbReset(102)
    END IF

    MyDb.dbColor = &#34;2,auto,lightblue&#34;
    MyDb.dbMode = &#34;both&#34; &#39; Want both Grid
    MyDb.dbGridTableTag=&#34;BORDER=3&#34; &#39; Set table border=3
    MyDb.dbImageDir = &#34;../images/&#34; &#39; Point to the Nav. icons
    MyDb.dbGridDisplayFlds = &#34;1, 2, 3, 4&#34;
    MyDb.dbNavigation=&#34;top&#34; &#39; Display it at the bottom only

    MyDb.dbNavigationItem=&#34;top,prev,next,bottom,re load,color&#34; &#39; Define which buttons
    MyDB.dbNavigationIcon = &#34;std&#34;
    MyDB.dbGridInc = 10
    MyDb.dbNameMap = &#34;cat_name,Category;problem,Problem;type_name,T ype;last_name,Submitter&#34;
    MyDb.dbGridTableTag = &#34;BORDER=3 CELLPADDING=3 CELLSPACING=3&#34; &#39; Specify our Grid Table Tags

    x1 = &#34;Problem, width=420,<A HREF=&#34;&#34;single_entry.asp?ID=#ID#&#34;&#34;> #Problem#</A>;&#34;
    x1 = x1 + &#34;type_name,Align=center width=60, <FONT FACE=&#39;Arial&#39; SIZE=&#39;2&#39; COLOR=&#39;black&#39;>#type_name# </FONT>;&#34;
    x1 = x1 + &#34;cat_name,Align=center width=130, <FONT FACE=&#39;Arial&#39; SIZE=&#39;2&#39; COLOR=&#39;black&#39;>#cat_name# </FONT>;&#34;
    x1 = x1 + &#34;last_name,Align=center width=60, <FONT FACE=&#39;Arial&#39; SIZE=&#39;2&#39; COLOR=&#39;black&#39;>#last_name# </FONT>;&#34;

    MyDb.dbMagicCell = x1
    MyDb.dbGridIndexLink = False
    MyDb.dbSQL = SQL

    MyDb.ASPdbpro &#39; Show the Database now!

    &#39;redirect back to the search engine page
    &#39;If MyDb.dbRecordCount = 0 then
    &#39; Response.Clear
    &#39; Response.Redirect &#34;redirect.asp&#34;
    &#39; Response.End
    &#39;End If

    &#39;End if
    %>

    <div align=&#34;center&#34;>
    <FORM>
    <input type=&#34;button&#34; value=&#34;Search Again?&#34; Onclick=&#34;again()&#34;>

    <input type=&#34;button&#34; value=&#34;Home&#34; name=&#34;Home&#34; OnClick=&#34;visitSite()&#34;
    </form>
    </div>

    </BODY>
    </HTML>


  2. #2
    Frank Guest

    dbreset? (reply)

    Paul,
    It is unlikely that anybody can help you with your particular appplication in a forum environment. If you want to solicit help then you shoul dpost &#34;clean&#34; and code using a common database like Northwind/Pubs/EMP or ACCESS, SQL and ORACLE. However, a quick look at your code tells me that you are changing the SQL dynamically w/o the correct reset. One expensive way is to use a different Unit number when using a different SQL. Otherwise, study the following code and see whether it helps...



    <%
    change=false
    if request.form(&#34;which&#34=&#34;1&#34; then
    session(&#34;DB&#34=&#34;employees&#34;
    change=true
    end if
    if request.form(&#34;which&#34=&#34;2&#34; then
    session(&#34;DB&#34=&#34;orders&#34;
    change=true
    end if
    if session(&#34;DB&#34=&#34;&#34; then session(&#34;DB&#34=&#34;employees&#34;

    response.write(request.form)
    Set X= Server.CreateObject(&#34;ASPdb.Y2K&#34
    X.dbUnit = 999
    if change then X.dbreset(999)
    X.dbDSN = &#34;DSN=NWIND&#34;
    X.dbSQL = &#34;SELECT * FROM &#34; & session(&#34;DB&#34
    X.ASPdbY2K
    %>

    <FORM ACTION=&#34;DB12.asp&#34; METHOD=&#34;POST&#34;>
    <INPUT TYPE=&#34;Text&#34; NAME=&#34;WHICH&#34;>
    <INPUT TYPE=&#34;Submit&#34;>
    </FORM>


    FK



    ------------
    Paul at 5/10/00 11:57:55 AM

    Here is the jist of my problem.

    I have constructed my own search engine and it gives the user the option of filtering the data. If a search comes back with more than 10 records, clicking on the Next button does not give the correct results. Pressing the Previous button doesn&#39;t come close to getting the original results returned. I have used many variations of the dbreset w/o any luck. Below I have included the code for the results. The &#39;*** comments are about the dbreset code tried. What I am I doing wrong?? Thanks in advance.

    <% @ Language=VBScript %>
    <!-- #include file=&#34;../../includethis.inc&#34;-->
    <% checkcookee() %>
    <% Response.Buffer = True %>

    <!-- * Page Function - Display Search Results in Table * -->

    <HTML>
    <HEAD>
    <TITLE>Search Results</TITLE></HEAD>

    <SCRIPT LANGUAGE=&#34;JavaScript&#34;>
    function again() {
    document.location=&#34;search.asp&#34;
    }

    function visitSite() {
    document.location=&#34;../default.asp&#34;
    }
    </SCRIPT>
    </HEAD>


    <BODY ALINK=&#34;Red&#34; VLINK=&#34;Navy&#34; LINK=&#34;Blue&#34; bgcolor=&#34;White&#34;>

    <div align=&#34;center&#34;><h2>Query Results</h2></div>
    <hr>

    <%

    Session( &#34;searchword&#34; ) = request.form(&#34;searchword&#34
    Session( &#34;searchword1&#34; ) = request.form(&#34;searchword1&#34
    Session( &#34;cat&#34; ) = request.form(&#34;category&#34
    Session( &#34;type1&#34; ) = request.form(&#34;testtype&#34
    Session( &#34;person&#34; ) = request.form(&#34;username&#34


    &#39; *** from the dbreset example -using this made the Next button display nothing
    &#39;If (Session( &#34;searchword&#34; ) <> &#34;&#34; Or Session( &#34;searchword1&#34; ) <> &#34;&#34; Or Session( &#34;cat&#34; ) <> &#34;&#34; Or Session( &#34;type1&#34; ) <> &#34;&#34; Or Session( &#34;person&#34; ) <> &#34;&#34; ) then

    &#39; Create the ASP-db object:
    Set MyDb = Server.CreateObject(&#34;ASPdb.Pro&#34
    &#39; Use YourFile.mdb in the current directory:
    MyDb.dbDSN = &#34;K_base&#34;

    MyDb.dbUnit=102

    SQL = &#34;Select main.id, main.problem, type.type_name, category.cat_name, employees.last_name FROM Main, Type, Category, Employees WHERE (&#34;
    If (Session( &#34;searchword&#34; ) <> &#34;&#34; ) then
    SQL = SQL + &#34; main.problem Like &#39;%&#34; + Session( &#34;searchword&#34; ) + &#34;%&#39; AND&#34;
    End If
    If (Session( &#34;searchword1&#34; ) <> &#34;&#34; ) then
    SQL = SQL + &#34; main.symptoms Like &#39;%&#34; + Session( &#34;searchword1&#34; ) + &#34;%&#39; AND&#34;
    End If
    If (Session( &#34;cat&#34; ) <> &#34;&#34; ) then
    SQL = SQL + &#34; main.category = &#34; + Session( &#34;cat&#34; ) + &#34; AND&#34;
    End If
    If (Session( &#34;type1&#34; ) <> &#34;&#34; ) then
    SQL = SQL + &#34; main.type = &#34; + Session( &#34;type1&#34; ) + &#34; AND&#34;
    End If
    If (Session( &#34;person&#34; ) <> &#34;&#34; ) then
    SQL = SQL + &#34; main.username = &#34; + Session( &#34;person&#34; ) + &#34; AND&#34;
    End If
    SQL = SQL + &#34; main.type = type.type_id AND main.category = category.cat_id AND main.username = employees.emp_id &#34;
    SQL = SQL + &#34&#34;


    &#39; ***** from the dbreset example
    If (request.form(&#34;searchword&#34 <> &#34;&#34; Or request.form(&#34;searchword1&#34 <> &#34;&#34; Or request.form(&#34;category&#34 <> &#34;&#34; Or request.form(&#34;testtype&#34 <> &#34;&#34; Or request.form(&#34;username&#34 <> &#34;&#34; ) then
    Mydb.dbReset(102)
    END IF

    MyDb.dbColor = &#34;2,auto,lightblue&#34;
    MyDb.dbMode = &#34;both&#34; &#39; Want both Grid
    MyDb.dbGridTableTag=&#34;BORDER=3&#34; &#39; Set table border=3
    MyDb.dbImageDir = &#34;../images/&#34; &#39; Point to the Nav. icons
    MyDb.dbGridDisplayFlds = &#34;1, 2, 3, 4&#34;
    MyDb.dbNavigation=&#34;top&#34; &#39; Display it at the bottom only

    MyDb.dbNavigationItem=&#34;top,prev,next,bottom,re load,color&#34; &#39; Define which buttons
    MyDB.dbNavigationIcon = &#34;std&#34;
    MyDB.dbGridInc = 10
    MyDb.dbNameMap = &#34;cat_name,Category;problem,Problem;type_name,T ype;last_name,Submitter&#34;
    MyDb.dbGridTableTag = &#34;BORDER=3 CELLPADDING=3 CELLSPACING=3&#34; &#39; Specify our Grid Table Tags

    x1 = &#34;Problem, width=420,<A HREF=&#34;&#34;single_entry.asp?ID=#ID#&#34;&#34;> #Problem#</A>;&#34;
    x1 = x1 + &#34;type_name,Align=center width=60, <FONT FACE=&#39;Arial&#39; SIZE=&#39;2&#39; COLOR=&#39;black&#39;>#type_name# </FONT>;&#34;
    x1 = x1 + &#34;cat_name,Align=center width=130, <FONT FACE=&#39;Arial&#39; SIZE=&#39;2&#39; COLOR=&#39;black&#39;>#cat_name# </FONT>;&#34;
    x1 = x1 + &#34;last_name,Align=center width=60, <FONT FACE=&#39;Arial&#39; SIZE=&#39;2&#39; COLOR=&#39;black&#39;>#last_name# </FONT>;&#34;

    MyDb.dbMagicCell = x1
    MyDb.dbGridIndexLink = False
    MyDb.dbSQL = SQL

    MyDb.ASPdbpro &#39; Show the Database now!

    &#39;redirect back to the search engine page
    &#39;If MyDb.dbRecordCount = 0 then
    &#39; Response.Clear
    &#39; Response.Redirect &#34;redirect.asp&#34;
    &#39; Response.End
    &#39;End If

    &#39;End if
    %>

    <div align=&#34;center&#34;>
    <FORM>
    <input type=&#34;button&#34; value=&#34;Search Again?&#34; Onclick=&#34;again()&#34;>

    <input type=&#34;button&#34; value=&#34;Home&#34; name=&#34;Home&#34; OnClick=&#34;visitSite()&#34;
    </form>
    </div>

    </BODY>
    </HTML>


  3. #3
    Paul Guest

    dbreset? (reply)

    Frank,

    Is the SQL statement being run all over again when the Next button is activated to get the 11-20 records?

    Paul


    ------------
    Frank at 5/10/00 4:32:45 PM

    Paul,
    It is unlikely that anybody can help you with your particular appplication in a forum environment. If you want to solicit help then you shoul dpost &#34;clean&#34; and code using a common database like Northwind/Pubs/EMP or ACCESS, SQL and ORACLE. However, a quick look at your code tells me that you are changing the SQL dynamically w/o the correct reset. One expensive way is to use a different Unit number when using a different SQL. Otherwise, study the following code and see whether it helps...



    <%
    change=false
    if request.form(&#34;which&#34=&#34;1&#34; then
    session(&#34;DB&#34=&#34;employees&#34;
    change=true
    end if
    if request.form(&#34;which&#34=&#34;2&#34; then
    session(&#34;DB&#34=&#34;orders&#34;
    change=true
    end if
    if session(&#34;DB&#34=&#34;&#34; then session(&#34;DB&#34=&#34;employees&#34;

    response.write(request.form)
    Set X= Server.CreateObject(&#34;ASPdb.Y2K&#34
    X.dbUnit = 999
    if change then X.dbreset(999)
    X.dbDSN = &#34;DSN=NWIND&#34;
    X.dbSQL = &#34;SELECT * FROM &#34; & session(&#34;DB&#34
    X.ASPdbY2K
    %>

    <FORM ACTION=&#34;DB12.asp&#34; METHOD=&#34;POST&#34;>
    <INPUT TYPE=&#34;Text&#34; NAME=&#34;WHICH&#34;>
    <INPUT TYPE=&#34;Submit&#34;>
    </FORM>


    FK



    ------------
    Paul at 5/10/00 11:57:55 AM

    Here is the jist of my problem.

    I have constructed my own search engine and it gives the user the option of filtering the data. If a search comes back with more than 10 records, clicking on the Next button does not give the correct results. Pressing the Previous button doesn&#39;t come close to getting the original results returned. I have used many variations of the dbreset w/o any luck. Below I have included the code for the results. The &#39;*** comments are about the dbreset code tried. What I am I doing wrong?? Thanks in advance.

    <% @ Language=VBScript %>
    <!-- #include file=&#34;../../includethis.inc&#34;-->
    <% checkcookee() %>
    <% Response.Buffer = True %>

    <!-- * Page Function - Display Search Results in Table * -->

    <HTML>
    <HEAD>
    <TITLE>Search Results</TITLE></HEAD>

    <SCRIPT LANGUAGE=&#34;JavaScript&#34;>
    function again() {
    document.location=&#34;search.asp&#34;
    }

    function visitSite() {
    document.location=&#34;../default.asp&#34;
    }
    </SCRIPT>
    </HEAD>


    <BODY ALINK=&#34;Red&#34; VLINK=&#34;Navy&#34; LINK=&#34;Blue&#34; bgcolor=&#34;White&#34;>

    <div align=&#34;center&#34;><h2>Query Results</h2></div>
    <hr>

    <%

    Session( &#34;searchword&#34; ) = request.form(&#34;searchword&#34
    Session( &#34;searchword1&#34; ) = request.form(&#34;searchword1&#34
    Session( &#34;cat&#34; ) = request.form(&#34;category&#34
    Session( &#34;type1&#34; ) = request.form(&#34;testtype&#34
    Session( &#34;person&#34; ) = request.form(&#34;username&#34


    &#39; *** from the dbreset example -using this made the Next button display nothing
    &#39;If (Session( &#34;searchword&#34; ) <> &#34;&#34; Or Session( &#34;searchword1&#34; ) <> &#34;&#34; Or Session( &#34;cat&#34; ) <> &#34;&#34; Or Session( &#34;type1&#34; ) <> &#34;&#34; Or Session( &#34;person&#34; ) <> &#34;&#34; ) then

    &#39; Create the ASP-db object:
    Set MyDb = Server.CreateObject(&#34;ASPdb.Pro&#34
    &#39; Use YourFile.mdb in the current directory:
    MyDb.dbDSN = &#34;K_base&#34;

    MyDb.dbUnit=102

    SQL = &#34;Select main.id, main.problem, type.type_name, category.cat_name, employees.last_name FROM Main, Type, Category, Employees WHERE (&#34;
    If (Session( &#34;searchword&#34; ) <> &#34;&#34; ) then
    SQL = SQL + &#34; main.problem Like &#39;%&#34; + Session( &#34;searchword&#34; ) + &#34;%&#39; AND&#34;
    End If
    If (Session( &#34;searchword1&#34; ) <> &#34;&#34; ) then
    SQL = SQL + &#34; main.symptoms Like &#39;%&#34; + Session( &#34;searchword1&#34; ) + &#34;%&#39; AND&#34;
    End If
    If (Session( &#34;cat&#34; ) <> &#34;&#34; ) then
    SQL = SQL + &#34; main.category = &#34; + Session( &#34;cat&#34; ) + &#34; AND&#34;
    End If
    If (Session( &#34;type1&#34; ) <> &#34;&#34; ) then
    SQL = SQL + &#34; main.type = &#34; + Session( &#34;type1&#34; ) + &#34; AND&#34;
    End If
    If (Session( &#34;person&#34; ) <> &#34;&#34; ) then
    SQL = SQL + &#34; main.username = &#34; + Session( &#34;person&#34; ) + &#34; AND&#34;
    End If
    SQL = SQL + &#34; main.type = type.type_id AND main.category = category.cat_id AND main.username = employees.emp_id &#34;
    SQL = SQL + &#34&#34;


    &#39; ***** from the dbreset example
    If (request.form(&#34;searchword&#34 <> &#34;&#34; Or request.form(&#34;searchword1&#34 <> &#34;&#34; Or request.form(&#34;category&#34 <> &#34;&#34; Or request.form(&#34;testtype&#34 <> &#34;&#34; Or request.form(&#34;username&#34 <> &#34;&#34; ) then
    Mydb.dbReset(102)
    END IF

    MyDb.dbColor = &#34;2,auto,lightblue&#34;
    MyDb.dbMode = &#34;both&#34; &#39; Want both Grid
    MyDb.dbGridTableTag=&#34;BORDER=3&#34; &#39; Set table border=3
    MyDb.dbImageDir = &#34;../images/&#34; &#39; Point to the Nav. icons
    MyDb.dbGridDisplayFlds = &#34;1, 2, 3, 4&#34;
    MyDb.dbNavigation=&#34;top&#34; &#39; Display it at the bottom only

    MyDb.dbNavigationItem=&#34;top,prev,next,bottom,re load,color&#34; &#39; Define which buttons
    MyDB.dbNavigationIcon = &#34;std&#34;
    MyDB.dbGridInc = 10
    MyDb.dbNameMap = &#34;cat_name,Category;problem,Problem;type_name,T ype;last_name,Submitter&#34;
    MyDb.dbGridTableTag = &#34;BORDER=3 CELLPADDING=3 CELLSPACING=3&#34; &#39; Specify our Grid Table Tags

    x1 = &#34;Problem, width=420,<A HREF=&#34;&#34;single_entry.asp?ID=#ID#&#34;&#34;> #Problem#</A>;&#34;
    x1 = x1 + &#34;type_name,Align=center width=60, <FONT FACE=&#39;Arial&#39; SIZE=&#39;2&#39; COLOR=&#39;black&#39;>#type_name# </FONT>;&#34;
    x1 = x1 + &#34;cat_name,Align=center width=130, <FONT FACE=&#39;Arial&#39; SIZE=&#39;2&#39; COLOR=&#39;black&#39;>#cat_name# </FONT>;&#34;
    x1 = x1 + &#34;last_name,Align=center width=60, <FONT FACE=&#39;Arial&#39; SIZE=&#39;2&#39; COLOR=&#39;black&#39;>#last_name# </FONT>;&#34;

    MyDb.dbMagicCell = x1
    MyDb.dbGridIndexLink = False
    MyDb.dbSQL = SQL

    MyDb.ASPdbpro &#39; Show the Database now!

    &#39;redirect back to the search engine page
    &#39;If MyDb.dbRecordCount = 0 then
    &#39; Response.Clear
    &#39; Response.Redirect &#34;redirect.asp&#34;
    &#39; Response.End
    &#39;End If

    &#39;End if
    %>

    <div align=&#34;center&#34;>
    <FORM>
    <input type=&#34;button&#34; value=&#34;Search Again?&#34; Onclick=&#34;again()&#34;>

    <input type=&#34;button&#34; value=&#34;Home&#34; name=&#34;Home&#34; OnClick=&#34;visitSite()&#34;
    </form>
    </div>

    </BODY>
    </HTML>


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •