ASP Search problem

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Lee Mundie

    ASP Search problem

    Hi, wonder if anyone can help me with this - This was originally a simple
    search routine returning results back to itself!
    Trying to be smart I tried to combine a no. items per page so I could
    limited items displayed...

    Okay problem! everything seems to be okay except it is returning no results,
    when I know it should
    the SQL string appears to be okay and if I remove the search criteria
    handlers then it kinda works but still not right!

    Can anyone tell me where the problem is - would be greatly appreciated.

    Thanks in advance

    Lee

    <%

    if Request.QuerySt ring("order") = "" then
    StrOrder = "p.prodCode "
    Else
    StrOrder = Request.QuerySt ring("order")
    End if
    Const adOpenKeyset = 1
    Const adLockReadOnly = 1

    set conn = server.createob ject("ADODB.Con nection")
    set rs = server.createob ject("ADODB.Rec ordset")

    conn.open "TTMYDB"

    Function FormatStr(Strin g)
    on Error resume next
    String = Replace(String, CHR(13), "")
    String = Replace(String, CHR(10) & CHR(10), "</P><P>")
    String = Replace(String, CHR(10), "<BR>")
    FormatStr = String
    End Function

    If Request.QuerySt ring("mode") = "doit" then
    keywords = split(Request.F orm("search"), " ")
    boolthing = true
    sql = "select distinct p.prodCode, p.prodName, p.productDesc, c.catalogName,
    p.productPrice, c.catalogID from products p, catalogs c where
    p.catalogID=c.c atalogID order by " & StrOrder

    for each word in keywords
    if boolthing then
    boolthing=false
    sql = sql & "and ("
    else
    sql = sql & "or"
    end if

    sql = sql & " p.prodName like '%" & word & "%' "
    sql = sql & "or p.productDesc like '%" & word & "%' "
    sql = sql & "or p.prodCode like '%" & word & "%' "
    sql = sql & "or c.catalogName like '%" & word & "%' "

    next
    sql = sql & ")"

    Response.Write Sql
    rs.open sql, conn, adOpenKeyset, adLockReadOnly

    if rs.EOF or rs.BOF then
    Response.Write "No Members Found"
    Else
    TotalRows = rs.RecordCount
    rs.PageSize = 2
    PageSize = rs.PageSize
    TotalPages=RS.P ageCount

    select case Request("move")
    case "first" pageNo = 1 ' First
    case "prev" pageNo = cint(Session("p age_num")) - 1 ' Next
    case "next" pageNo = cint(Session("p age_num")) + 1 ' Previous
    case "last" pageNo = TotalPages ' Last
    case Else PageNo = 1
    End Select

    if cint(PageNo) < 1 then PageNo = 1
    if cint(PageNo) > TotalPages then pageNo = TotalPages

    RS.AbsolutePage = PageNo
    PageNumber=Page No
    Session("page_n um") = PageNo
    Response.Write "<td>"

    HowMany = 0
    Do until rs.EOF or HowMany => PageSize

    Response.Write "<h1>Item: <a href='productre sult.asp?strpro dCode='" &
    rs("prodCode") & "'>"
    Response.Write "<b>" & rs("prodCode") & " - " & rs("prodName") & "</a></b>"
    Response.Write
    "<br>&nbsp;&nbs p;&nbsp;&nbsp;& nbsp;&nbsp;&nbs p;&nbsp;&nbsp;T his product is
    &pound;"
    Response.Write ""


    rs.MoveNext
    howmany = howmany + 1
    loop
    Response.Write " "
    End if

    %></td>
    <% end if %>


  • Bob Barrows

    #2
    Re: ASP Search problem

    Already answered over in .db

    Please do not multipost Lee. This is definitely a database-related
    question so .asp.db was the perfect group in which to post it. Posting it
    here as well did not increase your chances of getting an answer (most of us
    subscribe to both groups). On the contrary, if somebody had taken his time
    to answer it here, only to find that it was already resolved in the other
    group, that person may have been annoyed enough to ignore any future posts
    from you, thereby decreasing your chances of getting help in the future.

    There are times when you will not be sure which group is most appropriate
    (again, this was not one of them), and you will want to post a question to
    both groups. In that situation, you should use the cross-posting technique,
    rather than posting multiple postings of the same message. To crosspost, put
    a semicolon-delimited list of the newsgroups to which you wish to post in
    the To: header of your post and post it once. It, and any replies to it,
    will appear in all the newsgroups in your list. So, if I reply in .asp.db,
    my reply will also appear here in .asp.general.

    Bob Barrows
    --
    Microsoft MVP - ASP/ASP.NET
    Please reply to the newsgroup. This email account is my spam trap so I
    don't check it very often. If you must reply off-line, then remove the
    "NO SPAM"


    Comment

    • Evertjan.

      #3
      Re: ASP Search problem

      Bob Barrows wrote on 15 nov 2003 in
      microsoft.publi c.inetserver.as p.general:[color=blue]
      > To crosspost, put a semicolon-delimited list of the newsgroups to
      > which you wish to post in[/color]

      "semicolon-delimited": this depends on the usenet-client used.

      --
      Evertjan.
      The Netherlands.
      (Please change the x'es to dots in my emailaddress)

      Comment

      • Bob Barrows

        #4
        Re: ASP Search problem

        Evertjan. wrote:[color=blue]
        > Bob Barrows wrote on 15 nov 2003 in
        > microsoft.publi c.inetserver.as p.general:[color=green]
        >> To crosspost, put a semicolon-delimited list of the newsgroups to
        >> which you wish to post in[/color]
        >
        > "semicolon-delimited": this depends on the usenet-client used.[/color]

        OK, I'll amend that. Any suggestions?


        --
        Microsoft MVP - ASP/ASP.NET
        Please reply to the newsgroup. This email account is my spam trap so I
        don't check it very often. If you must reply off-line, then remove the
        "NO SPAM"


        Comment

        • Evertjan.

          #5
          Re: ASP Search problem

          Bob Barrows wrote on 15 nov 2003 in
          microsoft.publi c.inetserver.as p.general:[color=blue]
          > Evertjan. wrote:[color=green]
          >> Bob Barrows wrote on 15 nov 2003 in
          >> microsoft.publi c.inetserver.as p.general:[color=darkred]
          >>> To crosspost, put a semicolon-delimited list of the newsgroups to
          >>> which you wish to post in[/color]
          >>
          >> "semicolon-delimited": this depends on the usenet-client used.[/color]
          >
          > OK, I'll amend that. Any suggestions?[/color]

          Unless we go OT and set up a list of those clients with their individual
          peculiarities, no.

          But I will fight anyone that assumes M$-outlook as the implicit standard.

          --
          Evertjan.
          The Netherlands.
          (Please change the x'es to dots in my emailaddress)

          Comment

          • Bob Barrows

            #6
            Re: ASP Search problem

            Evertjan. wrote:[color=blue]
            > Bob Barrows wrote on 15 nov 2003 in
            > microsoft.publi c.inetserver.as p.general:[color=green]
            >> Evertjan. wrote:[color=darkred]
            >>> Bob Barrows wrote on 15 nov 2003 in
            >>> microsoft.publi c.inetserver.as p.general:
            >>>> To crosspost, put a semicolon-delimited list of the newsgroups to
            >>>> which you wish to post in
            >>>
            >>> "semicolon-delimited": this depends on the usenet-client used.[/color]
            >>
            >> OK, I'll amend that. Any suggestions?[/color]
            >
            > Unless we go OT and set up a list of those clients with their
            > individual peculiarities, no.
            >
            > But I will fight anyone that assumes M$-outlook as the implicit
            > standard.[/color]

            So I'll just add a footnote that one should use whatever delimiter is
            recognized by the news client.

            Bob

            --
            Microsoft MVP - ASP/ASP.NET
            Please reply to the newsgroup. This email account is my spam trap so I
            don't check it very often. If you must reply off-line, then remove the
            "NO SPAM"


            Comment

            • Evertjan.

              #7
              Re: ASP Search problem

              Bob Barrows wrote on 15 nov 2003 in
              microsoft.publi c.inetserver.as p.general:
              [color=blue][color=green]
              >> But I will fight anyone that assumes M$-outlook as the implicit
              >> standard.[/color]
              >
              > So I'll just add a footnote that one should use whatever delimiter is
              > recognized by the news client.
              >[/color]

              Cann't fight you, you are too smart.

              --
              Evertjan.
              The Netherlands.
              (Please change the x'es to dots in my emailaddress)

              Comment

              • Bob Barrows

                #8
                Re: ASP Search problem

                Evertjan. wrote:[color=blue]
                > Bob Barrows wrote on 15 nov 2003 in
                > microsoft.publi c.inetserver.as p.general:
                >[color=green][color=darkred]
                >>> But I will fight anyone that assumes M$-outlook as the implicit
                >>> standard.[/color]
                >>
                >> So I'll just add a footnote that one should use whatever delimiter is
                >> recognized by the news client.
                >>[/color]
                >
                > Cann't fight you, you are too smart.[/color]

                Well, maybe I'm smart enough to concede when I know I'm beaten. :-)

                --
                Microsoft MVP - ASP/ASP.NET
                Please reply to the newsgroup. This email account is my spam trap so I
                don't check it very often. If you must reply off-line, then remove the
                "NO SPAM"


                Comment

                • Aaron Bertrand [MVP]

                  #9
                  Re: ASP Search problem

                  > But I will fight anyone that assumes M$[sic]-outlook as the implicit
                  standard.

                  I'll bite. MS-Outlook does not have a newsreader. Perhaps you meant
                  Outlook Express.

                  A


                  Comment

                  • Ray at

                    #10
                    Re: ASP Search problem

                    msimn.exe /outnews = "Microsoft Outlook Newsreader"

                    Not that it's a different application, or anything...

                    Ray at home

                    "Aaron Bertrand [MVP]" <aaron@TRASHasp faq.com> wrote in message
                    news:e9bSDFArDH A.2520@TK2MSFTN GP09.phx.gbl...[color=blue][color=green]
                    > > But I will fight anyone that assumes M$[sic]-outlook as the implicit[/color]
                    > standard.
                    >
                    > I'll bite. MS-Outlook does not have a newsreader. Perhaps you meant
                    > Outlook Express.
                    >
                    > A
                    >
                    >[/color]


                    Comment

                    • Aaron Bertrand [MVP]

                      #11
                      Re: ASP Search problem

                      > msimn.exe /outnews = "Microsoft Outlook Newsreader"

                      msimn.exe is the program name for Outlook Express. The label you mention
                      above is a misnomer. Outlook is a part of Office, has its own executable
                      with the filename outlook.exe, and certainly contains no newsreader
                      functionality whatsoever.

                      I find it amusing when people spend so much time in here -- obviously they
                      are using the technology -- yet display their maturity and respect by using
                      stupid acronyms like "M$"... like their own software companies wouldn't be
                      interested in making money, or something. It's funny, too, that we talk
                      about Sybase and MySQL and plenty of other companies with "s" in their
                      names, who certainly make money from their sotware, and we don't stick a
                      dollar sign in their names.


                      Comment

                      • Ray at

                        #12
                        Re: ASP Search problem


                        "Aaron Bertrand [MVP]" <aaron@TRASHasp faq.com> wrote in message
                        news:OqJ6zXArDH A.2568@TK2MSFTN GP09.phx.gbl...[color=blue][color=green]
                        > > msimn.exe /outnews = "Microsoft Outlook Newsreader"[/color]
                        >
                        > msimn.exe is the program name for Outlook Express. The label you mention
                        > above is a misnomer. Outlook is a part of Office, has its own executable
                        > with the filename outlook.exe,[/color]

                        I'm completely aware of all that.
                        [color=blue]
                        > and certainly contains no newsreader
                        > functionality whatsoever.
                        >[/color]

                        No, that's not true. If you're in an Exchange environment, you can setup
                        newsfeed in Exchange and use Outlook as your news client.

                        [color=blue]
                        > I find it amusing when people spend so much time in here -- obviously they
                        > are using the technology -- yet display their maturity and respect by[/color]
                        using[color=blue]
                        > stupid acronyms like "M$"... like their own software companies wouldn't be
                        > interested in making money, or something. It's funny, too, that we talk
                        > about Sybase and MySQL and plenty of other companies with "s" in their
                        > names, who certainly make money from their sotware, and we don't stick a
                        > dollar sign in their names.[/color]

                        I 100% agree. People who use "M$" are idiots who don't get anything.

                        Ray at home


                        Comment

                        • Evertjan.

                          #13
                          Re: ASP Search problem

                          Aaron Bertrand [MVP] wrote on 16 nov 2003 in
                          microsoft.publi c.inetserver.as p.general:
                          [color=blue]
                          > X-Newsreader: Microsoft Outlook Express 6.00.3790.0
                          > X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0[color=green]
                          >> But I will fight anyone that assumes M$[sic]-outlook as the implicit[/color]
                          > standard.
                          >
                          > I'll bite. MS-Outlook does not have a newsreader. Perhaps you meant
                          > Outlook Express.[/color]

                          You all see the problem of implicitism. Next time I will add express
                          explicitly.

                          Anyway it is strange you all are quiveling about that and about the quite
                          common abbrevation "M$", while not commenting on the bad implicit way
                          advises are implicidly given assuming the implicid use of an implicid M$
                          product.

                          --
                          Evertjan.
                          The Netherlands.
                          (Please change the x'es to dots in my emailaddress)

                          Comment

                          • Chris Barber

                            #14
                            Re: ASP Search problem

                            I didn't even realise I was being branded an idiot by occasionally using the
                            term 'M$' as a common acronym for Microsoft - is this the general consensus
                            cos I don't feel more stupid than yesterday.

                            LoL (maybe).

                            Chris.


                            "Ray at <%=sLocation% >" <myfirstname at lane 34 . komm> wrote in message
                            news:uW$8h7ArDH A.2188@TK2MSFTN GP09.phx.gbl...

                            "Aaron Bertrand [MVP]" <aaron@TRASHasp faq.com> wrote in message
                            news:OqJ6zXArDH A.2568@TK2MSFTN GP09.phx.gbl...[color=blue][color=green]
                            > > msimn.exe /outnews = "Microsoft Outlook Newsreader"[/color]
                            >
                            > msimn.exe is the program name for Outlook Express. The label you mention
                            > above is a misnomer. Outlook is a part of Office, has its own executable
                            > with the filename outlook.exe,[/color]

                            I'm completely aware of all that.
                            [color=blue]
                            > and certainly contains no newsreader
                            > functionality whatsoever.
                            >[/color]

                            No, that's not true. If you're in an Exchange environment, you can setup
                            newsfeed in Exchange and use Outlook as your news client.

                            [color=blue]
                            > I find it amusing when people spend so much time in here -- obviously they
                            > are using the technology -- yet display their maturity and respect by[/color]
                            using[color=blue]
                            > stupid acronyms like "M$"... like their own software companies wouldn't be
                            > interested in making money, or something. It's funny, too, that we talk
                            > about Sybase and MySQL and plenty of other companies with "s" in their
                            > names, who certainly make money from their sotware, and we don't stick a
                            > dollar sign in their names.[/color]

                            I 100% agree. People who use "M$" are idiots who don't get anything.

                            Ray at home



                            Comment

                            • Ray at

                              #15
                              Re: ASP Search problem

                              Best not carry on this thread.

                              Ray at home

                              "Chris Barber" <chris@blue-canoe.co.uk.NOS PAM> wrote in message
                              news:evPdnZDrDH A.2416@TK2MSFTN GP10.phx.gbl...[color=blue]
                              > I didn't even realise I was being branded an idiot by occasionally using[/color]
                              the[color=blue]
                              > term 'M$' as a common acronym for Microsoft - is this the general[/color]
                              consensus[color=blue]
                              > cos I don't feel more stupid than yesterday.
                              >
                              > LoL (maybe).
                              >
                              > Chris.
                              >
                              >
                              > "Ray at <%=sLocation% >" <myfirstname at lane 34 . komm> wrote in message
                              > news:uW$8h7ArDH A.2188@TK2MSFTN GP09.phx.gbl...
                              >
                              > "Aaron Bertrand [MVP]" <aaron@TRASHasp faq.com> wrote in message
                              > news:OqJ6zXArDH A.2568@TK2MSFTN GP09.phx.gbl...[color=green][color=darkred]
                              > > > msimn.exe /outnews = "Microsoft Outlook Newsreader"[/color]
                              > >
                              > > msimn.exe is the program name for Outlook Express. The label you[/color][/color]
                              mention[color=blue][color=green]
                              > > above is a misnomer. Outlook is a part of Office, has its own[/color][/color]
                              executable[color=blue][color=green]
                              > > with the filename outlook.exe,[/color]
                              >
                              > I'm completely aware of all that.
                              >[color=green]
                              > > and certainly contains no newsreader
                              > > functionality whatsoever.
                              > >[/color]
                              >
                              > No, that's not true. If you're in an Exchange environment, you can setup
                              > newsfeed in Exchange and use Outlook as your news client.
                              >
                              >[color=green]
                              > > I find it amusing when people spend so much time in here -- obviously[/color][/color]
                              they[color=blue][color=green]
                              > > are using the technology -- yet display their maturity and respect by[/color]
                              > using[color=green]
                              > > stupid acronyms like "M$"... like their own software companies wouldn't[/color][/color]
                              be[color=blue][color=green]
                              > > interested in making money, or something. It's funny, too, that we talk
                              > > about Sybase and MySQL and plenty of other companies with "s" in their
                              > > names, who certainly make money from their sotware, and we don't stick a
                              > > dollar sign in their names.[/color]
                              >
                              > I 100% agree. People who use "M$" are idiots who don't get anything.
                              >
                              > Ray at home
                              >
                              >
                              >[/color]


                              Comment

                              Working...