Welcome, Guest ( Customer Panel | Login )




 All Forums
 VPCart Forum
 VP-ASP 6.00 Questions
 why does = not mean =?
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

dandlyin
VP-CART New User

USA
73 Posts

Posted - August 04 2006 :  20:15:15  Show Profile  Visit dandlyin's Homepage  Reply with Quote
re: v6.08, using Access

A call to shopquery.asp?ccode=1130 returns products that have 1130 and 113000 as their ccode value- why? Is there a workaround?
Thanks,
Dan Dotson

dandlyin
VP-CART New User

USA
73 Posts

Posted - August 06 2006 :  06:45:47  Show Profile  Visit dandlyin's Homepage  Reply with Quote
I found the problem. For all text variables, including ccode, the script shopproductcreatesql.asp creates a query that returns all records that CONTAIN the input text.
Around line 316:

if fieldtype="Text" or fieldtype="Memo" then
If ucase(strvalue)=allvalues then ' make all really mean all
strvalue=""
end if
addprefix
tvalue=cleanchars(strvalue)
SQL=SQL & " p." & strname & " like '" & queryprefix & tvalue & "%'"

I find this unsatisfactory. In my opinion, a flag should be added to permit setting the query to reurn only those records that EQUAL the input text.

Here is my solution:

Around line 304, add
dim forcematch
forcematch=""
forcematch=request("forcematch")

and replace the line that reads
SQL=SQL & " p." & strname & " like '" & queryprefix & tvalue & "%'"
with

if forcematch <> "" then
SQL=SQL & " p." & strname & "='" & tvalue & "'"
else
SQL=SQL & " p." & strname & " like '" & queryprefix & tvalue & "%'"
end if

Now a call
shopquery.asp?ccode=87&forcematch=1
returns only the record where ccode=87

This solution works for me but as always, I welcome comments.
Regards
Dan Dotson
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
Snitz Forums 2000
0 Item(s)
$0.00