Wrox Home  
Search P2P Archive for: Go

  Return to Index  

access_asp thread: Undesireable data showing up in search


Message #1 by "Constans Bezuidenhout" <constansb@w...> on Sat, 2 Mar 2002 22:09:01
I need help on problem I'm having!



How can I let a database record show up on in a search, only after that 

record fulfills a certain criteria?



Let me explain!

Say I have a site that searches for companies eg. computer companies, and 

the company has to pay me to include it in the search. How can I let his 

data in (the database) turn up in the search only after he has paid me!



I have a piece of code but I don't know what to do with it or even if it 

will help me: 



<%If rcdSearch.Fields.Item("DatPaid") = True Then%> variabletextinhtml <% 

end if %>

Replace rcdSearch with the name of your recordset.



PLEASE HELP ME!!!!!

Thanx!

Constans

Message #2 by "Zee Computer Consulting" <zee@t...> on Sun, 3 Mar 2002 14:05:42 -0800
The simplest method is to craft your SQL statement to exclude the undesired

records, for example:



    SqlString = "SELECT * FROM Company " _

                    & " WHERE PaymentFlag = TRUE " _

                    & " ORDER BY Price "



and then open the recordset with this SQL string. This is probably the most

efficient.





After a recordset has already been retrieved, you can exclude the

nonqualifying records, as in your code snippet. Restating that method for

clarity:



    ' Loop through the records

    DO WHILE NOT CompanyRecordset.eof



        IF CompanyRecordset( "PaymentFlag" )

            ' Payment was made so display this record

            ' (insert your record display code here)

            Response.Write( "<p>" & CompanyRecordset( "CompanyName" ) &

"</p>" )

            Response.Write( "<p>" & CompanyRecordset( "Price" ) & "</p>" )

        ELSE

            ' Payment wasn't made so do nothing

        END IF



        ' Move to the next record

        CompanyRecordset.MoveNext



    LOOP

    ' End of record processing loop





Does this help?



-- Zee









----- Original Message -----

From: "Constans Bezuidenhout" <constansb@w...>

To: "Access ASP" <access_asp@p...>

Sent: Saturday, March 02, 2002 10:09 PM

Subject: [access_asp] Undesireable data showing up in search





> I need help on problem I'm having!

>

> How can I let a database record show up on in a search, only after that

> record fulfills a certain criteria?

>

> Let me explain!

> Say I have a site that searches for companies eg. computer companies, and

> the company has to pay me to include it in the search. How can I let his

> data in (the database) turn up in the search only after he has paid me!

>

> I have a piece of code but I don't know what to do with it or even if it

> will help me:

>

> <%If rcdSearch.Fields.Item("DatPaid") = True Then%> variabletextinhtml <%

> end if %>

> Replace rcdSearch with the name of your recordset.

>

> PLEASE HELP ME!!!!!

> Thanx!

> Constans

>




$subst('Email.Unsub').




  Return to Index