Basic4ppc - Windows Mobile Development  

Go Back   Basic4ppc - Windows Mobile Development > Main Category > Questions & Help Needed
Home Register FAQ Members List Search Today's Posts Mark Forums Read

Questions & Help Needed Post any question regarding Basic4ppc.


Problem with "%" character


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 11-19-2007, 07:59 AM
Junior Member
 
Join Date: May 2007
Posts: 34
Default Problem with "%" character

Hello,
I'm trying to filter a csv database, but I get an error when the variable "cad" has a % in the string: (cad="something%"), f example:

Table1.Filter("cara_pcb LIKE '"&cara& "'AND " &campo & " LIKE '" & cad & "'")

This works well if the strings don't contain any "%" or "[]"
Is there any other method?
Reply With Quote
  #2 (permalink)  
Old 11-19-2007, 08:30 AM
Erel's Avatar
Administrator
 
Join Date: Apr 2007
Posts: 3,135
Default

You should enclose %, [ and ] characters with [].
Example: 'something[%]'
Reply With Quote
  #3 (permalink)  
Old 11-19-2007, 09:45 AM
Junior Member
 
Join Date: May 2007
Posts: 34
Default Problem with % character

Quote:
Originally Posted by Erel View Post
You should enclose %, [ and ] characters with [].
Example: 'something[%]'
I've tried this, but I get the same error, if I don't include this character there is no problem ¿?
cad="H64 10[%] 100V LDIL10 AVX/NI"
Reply With Quote
  #4 (permalink)  
Old 11-19-2007, 09:56 AM
Junior Member
 
Join Date: May 2007
Posts: 34
Default problem with % character

Quote:
Originally Posted by francisco cobos View Post
I've tried this, but I get the same error, if I don't include this character there is no problem ¿?
cad="H64 10[%] 100V LDIL10 AVX/NI"
I'm sorry Erel, I was worng:
I have tried again your solution and now is fine,
Thanks!

Anyway, is there any solution for not to have to change the data in the data base?
Reply With Quote
  #5 (permalink)  
Old 11-19-2007, 10:01 AM
Erel's Avatar
Administrator
 
Join Date: Apr 2007
Posts: 3,135
Default

There is no need to change the database.
To properly search for a string with % (using Like):
Code:
Table1.Filter("cara_pcb LIKE '"&cara& "'AND " &campo & " LIKE '" & StrReplace(cad,"%","[%]") & "'")
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem with "Task.StartDate" in Outlook.dll JOTHA Bug Reports 9 09-19-2008 03:19 PM
TabControl "addControl" problem. burd27 Questions & Help Needed 4 04-20-2008 09:42 AM
Problem with Serial. ("before loop" error) jesb4ppc Questions & Help Needed 3 02-15-2008 06:41 PM
calling the device's "Programs" or "settings" screens HarleyM Questions & Help Needed 0 12-05-2007 03:59 AM
SetUpBuilder Problem - "Build Cabs first" dhillinmkewi Questions & Help Needed 1 07-27-2007 09:20 AM


All times are GMT. The time now is 06:25 AM.


Powered by vBulletin® Version 3.6.12
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.1.0