Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Using Like in a SQL Passthru Query
Message
From
18/04/2011 18:38:36
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Using Like in a SQL Passthru Query
Miscellaneous
Thread ID:
01507766
Message ID:
01507766
Views:
111
When I run this query from the Query analyzer, I get the all rows within those dates where the sealnumber contains 123

>>SELECT FROM view_depositactivity WHERE postingdate BETWEEN '2011-03-01' AND '2011-03-15' and sealnumber LIKE '%123%'

I'm trying to pass the 123 as a ? argument in a SQL passthru query and can't figure out how to do it.

When I just have the dates in the query I get the right answer.

I'm getting no records back when I use the LIKE clause for the sealnumber

The code below is my latest futile attempt

Any suggestions?
lc_sealnumber = "'%" + ALLTRIM(thisform.lc_sealnumber) + "%'"
    
lc_sqlstring = "SELECT * FROM view_depositactivity WHERE postingdate BETWEEN ?ld_startdate AND ?ld_enddate "
lc_sqlstring = lc_sqlstring + " AND sealnumber LIKE ?lc_sealnumber"
= sqlprepare(gnconnhandle, lc_sqlstring, "curactivity")
IF oApp.gf_sqlexec(gnconnhandle)
 
  SELECT curactivity
  GO TOP
  BROWSE

ENDIF 
Anyone who does not go overboard- deserves to.
Malcolm Forbes, Sr.
Next
Reply
Map
View

Click here to load this message in the networking platform