[thelist] sql filtering problem

dn at dittodesign.co.uk dn at dittodesign.co.uk
Tue Aug 27 10:54:01 CDT 2002


thanks darren but it would take me a while to figure out
how to get this code into the page and weld with the
recorset on there. :-(

Darren


----- Original Message -----
From: "darren" <darren at web-bitch.co.uk>
To: <thelist at lists.evolt.org>
Sent: Tuesday, August 27, 2002 4:22 PM
Subject: Re[2]: [thelist] sql filtering problem


> On Tuesday, August 27, 2002 at 15:55, dn at dittodesign.co.uk wrote:
>
> ddcu> is the result of choices made over two pages each containing
> ddcu> a drop box. So case is not an issue.
>
> ddcu> I need to filter the result page by the two variables in the url.
>
> how about something like:
>
>    dim brand, productType, strSQL, objCon, objRc
>
>    brand = Request.QueryString("Brand")
>    productType = Request.QueryString("Product_Type")
>
>    ' you might want to response.write these to make sure they have the
>    ' correct values
>
>    strSQL = "SELECT Brand_Logo, Brand_Logo_sml, ID, Product_Type, Brand, "
& _
>             "Model, Reference_No, Colour, image, Retail_Price, " & _
>             "Delivery_Charge FROM kitchen_appliance WHERE 1 = 1"
>
>    if len(brand) > 0 then strSQL = strSQL & " brand = '" & brand & "'"
>    if len(productType) > 0 then strSQL = strSQL & " Product_Type = '" &
>    productType & "'"
>
>    set objCon = Server.CreateObject("ADODB.Connection")
>    set objRc = Server.CreateObject("ADODB.Recordset")
>    objCon.Open yourConnectionString
>    objRc.CursorLocation = adUseServer
>    objRc.Open strSQL, objCon, adOpenForwardOnly, , adCmdText
>
>    if (objRc.BOF and objRc.EOF) then
>       ' you have no records
>    else
>       ' process your result set
>    end if
>
>    objRc.Close
>    objCon.Close
>    set objRc = nothing
>    set objCon = nothing
>
> hth,
>
> darren
>
> --
> For unsubscribe and other options, including
> the Tip Harvester and archive of thelist go to:
> http://lists.evolt.org Workers of the Web, evolt !
>




More information about the thelist mailing list