Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Anders Altberg
  Where is Anders Altberg?
 Uppsala
 Sweden
 Anders Altberg
 To: Pratik Singh
  Where is Pratik Singh?
 Kota
 India
 Pratik Singh
 Tags
Subject: RE: Optimization Data Retreive
Thread ID: 393707 Message ID: 393777 # Views: 51 # Ratings: 0
Version: Visual FoxPro 9 SP2 Category: Databases, Tables and SQL Server
Date: Monday, December 23, 2013 11:01:28 AM         
   


> THANKS BOTH
>
> i have also a issue please tell me where is mistake because when i run this query it shows error
>
> when i use where condition with customer.name like 'rajesh%' it shows result
> but when i use customer.name like ?thisform.text1.value+'%' it shows inputbox even i have also thisform.text1.value in form.
>
> if i fill rajesh in inputbox it shows also no result where is mistake
>
>
>
> note:  thisform.text1.value = 'rajesh'
> 
> 
> TEXT TO freshsearch ADDITIVE NOSHOW
> 	SELECT customer.name,customer.address,IFNULL(city.NAME,'') AS cityname,IFNULL(state.NAME,'') AS statename,
> 	IFNULL(country.NAME,'') AS coname
> 	FROM customer
> 	LEFT JOIN city ON customer.CITY = city.ID
> 	LEFT JOIN state ON city.STATE = state.ID
> 	LEFT JOIN country on customer.country = country.id
> 	WHERE customer.name LIKE ?thisform.text1.value+'%'
> ENDTEXT
> 
> IF SQLEXEC(mySqlConnection,m.FRESHSEARCH,'ABC') < 0
>    AERROR(aa)
>    =MESSAGEBOX(AA[1,2])
> ELSE
>    SELECT ABC
>    BROW NORMAL
> ENDIF
> 
> 
> Regards
> Pratik
> 
> 
> 
> 


I'd think it's preferable to move object references to a variable:
 LOCAL x
 x = TRIM(Thisform.Text1.Value) +'%'
 ...
 ... LIKE ?m.x

-Anders

ENTIRE THREAD

Optimization Data Retreive Posted by Pratik Singh @ 12/22/2013 12:03:38 PM
RE: Optimization Data Retreive Posted by Anders Altberg @ 12/22/2013 5:29:15 PM
RE: Optimization Data Retreive Posted by Binod Binani @ 12/23/2013 10:00:20 AM
RE: Optimization Data Retreive Posted by Pratik Singh @ 12/23/2013 10:42:14 AM
RE: Optimization Data Retreive Posted by Anders Altberg @ 12/23/2013 11:01:28 AM
RE: Optimization Data Retreive Posted by Vivek Deodhar @ 12/24/2013 5:01:16 AM