Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

A little help with ASP?

2»

Comments

  • Registered Users, Registered Users 2 Posts: 202 ✭✭bribren2001


    louie i think ill let you go after this, ive been killing you all day, thanks a million though,

    Microsoft VBScript compilation error '800a03fb'

    Expected 'Loop'

    /rivolinho/search1.asp, line 83


  • Closed Accounts Posts: 1,200 ✭✭✭louie


    send a copy of that page


  • Registered Users, Registered Users 2 Posts: 202 ✭✭bribren2001


    <%@LANGUAGE=&quot;VBSCRIPT" CODEPAGE="1252"%>
    <%response.buffer = true%>
    <%
    Dim SearchParam
    SearchParam = Trim(Request("SearchParam"))

    Dim CompType, t3_advSearch_String
    'Store type of query in CompType ie All Words/OR, Any Word/AND or Exact Phrase/EXACT
    CompType = Request("CompType")
    SearchColumn = "Game_title"

    SearchField = "zzz"
    if(Request("SearchParam") <> "") then SearchField = Request("SearchParam")
    'Remove any single quotes from search field to eliminate potential errors.
    SearchField = Replace(SearchField, "'", "")
    SearchField = Replace(SearchField, " ", " ")

    'Checks the CompType, Executes this code if the option All words or Any Word is chosen
    if(CompType <> "EXACT") then
    t3_advSearch_String = "WHERE " & SearchColumn & " LIKE '%"
    'Splits the search criteria into seperate words and stores them in an Array
    SearchArray=Split(SearchField," ")
    for i = 0 to Ubound(SearchArray)
    if i > 0 then
    'Builds the sql statement using the CompType to substitute AND/OR
    t3_advSearch_String = t3_advSearch_String & " " & CompType & " " & SearchColumn & " LIKE '%"& SearchArray(i) & "%'"
    else
    'Ends the sql statement if there is only one word
    t3_advSearch_String = t3_advSearch_String & SearchArray(i) & "%' "
    end if
    next

    else
    t3_advSearch_String = "WHERE " & SearchColumn & " LIKE '%" & SearchField & "%' "
    end if

    Dim rsSearch__t3_String
    'rsSearch__t3_String = "WHERE ID=1"
    if (t3_advSearch_String <> "") then rsSearch__t3_String = t3_advSearch_String

    set rsSearch = Server.CreateObject("ADODB.Recordset")
    rsSearch.ActiveConnection =("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("db\Game Emporium.mdb") & ";Persist Security Info=False")
    rsSearch.Source = "SELECT * FROM Game " + Replace(rsSearch__t3_String, "'", "'")
    rsSearch.CursorType = 0
    rsSearch.CursorLocation = 2
    rsSearch.LockType = 1
    rsSearch.Open()
    rsSearch_numRows = 0
    %>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"&gt;
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <title>Untitled Document</title>
    </head>

    <body>
    <form name="search" id="search" method="get" action="search1.asp">
    <br />
    <br />
    <input name="SearchParam" type="text" class="btn" id="SearchParam" value="<%=UCase(Trim(Request("SearchParam")))%>" size="45" />
    <select name="CompType" class="TEXTAREA" id="CompType">
    <option value="<%=Request("CompType")%>" selected="selected"><%=Request("CompType")%></option>
    <option value="OR">All Words</option>
    <option value="AND">Any Word</option>
    <option value="EXACT">Exact Phrase</option>
    </select>
    <input name="Search" type="submit" class="btn" id="Search" value="Search" />
    </form>
    <%if (rsSearch.Fields.Item("Game_title").Value) <> "" Then%>
    <%
    Do While NOT rsSearch.EOF
    %>
    <% If Not rsSearch.EOF Or Not rsSearch.BOF Then %>
    <%
    Do While NOT rsSearch.EOF
    %>
    <li><%=(rsSearch.Fields.Item("Game_title").Value)%></li>
    <%
    rsSearch.MoveNext
    Loop
    %>
    <% End If ' end Not rsSearch.EOF Or NOT rsSearch.BOF %>


  • Closed Accounts Posts: 1,200 ✭✭✭louie


    <%@LANGUAGE=&quot;VBSCRIPT" CODEPAGE="1252"%>
    <%response.buffer = true%>
    <%
    Dim SearchParam
    SearchParam = Trim(Request("SearchParam"))

    Dim CompType, t3_advSearch_String
    'Store type of query in CompType ie All Words/OR, Any Word/AND or Exact Phrase/EXACT
    CompType = Request("CompType")
    SearchColumn = "Game_title"

    SearchField = "zzz"
    if(Request("SearchParam") <> "") then SearchField = Request("SearchParam")
    'Remove any single quotes from search field to eliminate potential errors.
    SearchField = Replace(SearchField, "'", "")
    SearchField = Replace(SearchField, " ", " ")

    'Checks the CompType, Executes this code if the option All words or Any Word is chosen
    if(CompType <> "EXACT") then
    t3_advSearch_String = "WHERE " & SearchColumn & " LIKE '%"
    'Splits the search criteria into seperate words and stores them in an Array
    SearchArray=Split(SearchField," ")
    for i = 0 to Ubound(SearchArray)
    if i > 0 then
    'Builds the sql statement using the CompType to substitute AND/OR
    t3_advSearch_String = t3_advSearch_String & " " & CompType & " " & SearchColumn & " LIKE '%"& SearchArray(i) & "%'"
    else
    'Ends the sql statement if there is only one word
    t3_advSearch_String = t3_advSearch_String & SearchArray(i) & "%' "
    end if
    next

    else
    t3_advSearch_String = "WHERE " & SearchColumn & " LIKE '%" & SearchField & "%' "
    end if

    Dim rsSearch__t3_String
    'rsSearch__t3_String = "WHERE ID=1"
    if (t3_advSearch_String <> "") then rsSearch__t3_String = t3_advSearch_String

    set rsSearch = Server.CreateObject("ADODB.Recordset")
    rsSearch.ActiveConnection =("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("db\Game Emporium.mdb") & ";Persist Security Info=False")
    rsSearch.Source = "SELECT * FROM Game " + Replace(rsSearch__t3_String, "'", "'")
    rsSearch.CursorType = 0
    rsSearch.CursorLocation = 2
    rsSearch.LockType = 1
    rsSearch.Open()
    rsSearch_numRows = 0
    %>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"&gt;
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <title>Untitled Document</title>
    </head>

    <body>
    <form name="search" id="search" method="get" action="search1.asp">
    <br />
    <br />
    <input name="SearchParam" type="text" class="btn" id="SearchParam" value="<%=UCase(Trim(Request("SearchParam")))%>" size="45" />
    <select name="CompType" class="TEXTAREA" id="CompType">
    <option value="<%=Request("CompType")%>" selected="selected"><%=Request("CompType")%></option>
    <option value="OR">All Words</option>
    <option value="AND">Any Word</option>
    <option value="EXACT">Exact Phrase</option>
    </select>
    <input name="Search" type="submit" class="btn" id="Search" value="Search" />
    </form>

    <% If Not rsSearch.EOF Or Not rsSearch.BOF Then %>
    <%
    Do While NOT rsSearch.EOF
    %>
    <li><%=(rsSearch.Fields.Item("Game_title").Value)%></li>
    <%
    rsSearch.MoveNext
    Loop
    %>
    <% End If ' end Not rsSearch.EOF Or NOT rsSearch.BOF %>
    </body>
    </html>
    <%
    rsSearch.Close()
    Set rsSearch = Nothing
    %>


  • Registered Users, Registered Users 2 Posts: 202 ✭✭bribren2001


    it works!! great stuff,thanks alot louie,il write to your boss demanding you get a payed week off!

    id say youll need it after goin through that never ending problem code!


  • Advertisement
  • Closed Accounts Posts: 1,200 ✭✭✭louie


    I am glad it's all working.


Advertisement