Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
The Like Clause
Message
 
 
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows 7
Network:
Windows 2008 Server
Database:
Visual FoxPro
Application:
Desktop
Miscellaneous
Thread ID:
01546034
Message ID:
01546036
Views:
51
>I am trying to get the Like clause to work in my SQL, but I keep coming back with no results. Can anybody see what I am doing wrong?
>
>Thanks!
>
>
Lparameters tnOption
>
>Thisform.ofile.Open('bond')
>Thisform.ofile.Open('bond_redemptions')
>
>Local lcTitle, lnKey, laResults[1,2], i, lcProject
>
>If tnOption = 1
>	Select Distinct Rtrim(Title) + ' ' + title2 As cTitle, bond_redemptions.ky ;
>		FROM bond ;
>		INNER Join bond_redemptions On ;
>		bond.ky = bondky ;
>		WHERE reDate = This.txtInput.Value ;
>		INTO Array laResults ;
>		order By cTitle
>ELSE
>	lcProject = Alltrim(This.txtInput.Value)+'*'
>	Select Distinct Rtrim(Title) + ' ' + RTRIM(title2) + '   ' + Dtoc(bond_redemptions.reDate) + ;
>		'   ' + Alltrim(Str(bond_redemptions.amount)) As cTitle, bond_redemptions.ky ;
>		FROM bond ;
>		INNER Join bond_redemptions On ;
>		bond.ky = bondky ;
>		WHERE bond_redemptions.Project like lcProject ;
>		INTO Array laResults ;
>		order By cTitle
>Endif
>
>lnItems = _Tally
>
>Use In bond
>Use In bond_redemptions
>
>With This.lstBonds
>	.Clear()
>	For i = 1 To lnItems
>		.AddItem(laResults[i, 1])
>		.ItemData[.NewIndex] = laResults[i, 2]
>		.ListIndex = i
>	Endfor
>	If .ListIndex = 0
>		.ListIndex = 1
>	Endif
>	.ListIndex = 1
>Endwith
>
>
>
>This.lstBonds.SetFocus()
The character should be % not *, e.g.

LIKE 'MyValue%'
If it's not broken, fix it until it is.


My Blog
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform