Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.clipper.visual-objects > #6647 > unrolled thread

Search character ' with "find"

Started byLu <lu2k@hotmail.com>
First post2014-03-11 00:59 -0700
Last post2014-03-12 06:03 -0700
Articles 14 — 5 participants

Back to article view | Back to comp.lang.clipper.visual-objects


Contents

  Search character ' with "find" Lu <lu2k@hotmail.com> - 2014-03-11 00:59 -0700
    Re: Search character ' with "find" D.J.W. van Kooten <vankooten@removethis.ic2.com> - 2014-03-11 09:27 +0100
      Re: Search character ' with "find" Lu <lu2k@hotmail.com> - 2014-03-11 02:24 -0700
        Re: Search character ' with "find" Karl Faller <mail_withoutthat_@_drei-f_andthat_.de> - 2014-03-11 11:20 +0100
    Re: Search character ' with "find" Johan Nel <johan.nel@xsinet.co.za> - 2014-03-11 03:49 -0700
      Re: Search character ' with "find" Lu <lu2k@hotmail.com> - 2014-03-11 05:14 -0700
        Re: Search character ' with "find" Malcolm G <malcolm-news2012delete@delete.jobstream.com> - 2014-03-11 12:34 +0000
        Re: Search character ' with "find" Johan Nel <johan.nel@xsinet.co.za> - 2014-03-11 05:41 -0700
          Re: Search character ' with "find" Lu <lu2k@hotmail.com> - 2014-03-12 00:49 -0700
            Re: Search character ' with "find" Johan Nel <johan.nel@xsinet.co.za> - 2014-03-12 01:29 -0700
              Re: Search character ' with "find" Johan Nel <johan.nel@xsinet.co.za> - 2014-03-12 01:34 -0700
            Re: Search character ' with "find" Malcolm G <malcolm-news2012delete@delete.jobstream.com> - 2014-03-12 09:29 +0000
              Re: Search character ' with "find" Lu <lu2k@hotmail.com> - 2014-03-12 05:24 -0700
                Re: Search character ' with "find" Johan Nel <johan.nel@xsinet.co.za> - 2014-03-12 06:03 -0700

#6647 — Search character ' with "find"

FromLu <lu2k@hotmail.com>
Date2014-03-11 00:59 -0700
SubjectSearch character ' with "find"
Message-ID<e3038325-3a6d-44ed-bf80-eae9274edcfb@googlegroups.com>
Hello VO experts,

Is it possible to use the ' character in a find statement.

For Example:
cText := self:odcBrowser:SErver:fieldget(#Text)
self:odcbBrowser:Server:Find("Text='+cText+ "'")

If cText contains ' I get an error.

Thank you for any tips.
Lu

[toc] | [next] | [standalone]


#6648

FromD.J.W. van Kooten <vankooten@removethis.ic2.com>
Date2014-03-11 09:27 +0100
Message-ID<q5ith9djuec9sqr1prkcip5p786ngo457k@4ax.com>
In reply to#6647
On Tue, 11 Mar 2014 00:59:32 -0700 (PDT), Lu <lu2k@hotmail.com> wrote:

Hello Lu,

>Is it possible to use the ' character in a find statement.
>
>For Example:
>cText := self:odcBrowser:SErver:fieldget(#Text)
>self:odcbBrowser:Server:Find("Text='+cText+ "'")
>
Maybe it helps if you build it with Alt(39)?

Dick

[toc] | [prev] | [next] | [standalone]


#6649

FromLu <lu2k@hotmail.com>
Date2014-03-11 02:24 -0700
Message-ID<fbe1c445-ca50-4827-a5f6-56e3c9192223@googlegroups.com>
In reply to#6648
Hi Dick!
Thank you for your quick answer. What do you mean with Alt(39)? Do you think I should put Alt(39) before the character ' ?

Lu



[toc] | [prev] | [next] | [standalone]


#6650

FromKarl Faller <mail_withoutthat_@_drei-f_andthat_.de>
Date2014-03-11 11:20 +0100
Message-ID<spoth9d7ls11mmtf060dgolo9iqg7idgdq@4ax.com>
In reply to#6649
Lu,
Dick had a typo, what he meant was, use CHR(39)

HTH
Karl

>Hi Dick!
>Thank you for your quick answer. What do you mean with Alt(39)? Do you think I should put Alt(39) before the character ' ?
>
>Lu
>
>
>

[toc] | [prev] | [next] | [standalone]


#6651

FromJohan Nel <johan.nel@xsinet.co.za>
Date2014-03-11 03:49 -0700
Message-ID<8c98f541-4130-48c6-bdab-489e1a193a4c@googlegroups.com>
In reply to#6647
Hi Lu,

> Is it possible to use the ' character in a find statement.
> For Example:
> cText := self:odcBrowser:SErver:fieldget(#Text)
> self:odcbBrowser:Server:Find("Text='+cText+ "'")
> If cText contains ' I get an error.

You have an unterminated string in the above.

Try:
self:odbcBrowser:Server:Find('Text="' + cText + "'" + '"')

Maybe to see your problem try and check via the debugger what the value of cTxt is:
cTxt := 'Text="' + cText + "'" + '"'
self:odbcBrowser:Server:Find(cTxt)

HTH,

Johan Nel
Vulcan VIP
Durban, South Africa.

[toc] | [prev] | [next] | [standalone]


#6652

FromLu <lu2k@hotmail.com>
Date2014-03-11 05:14 -0700
Message-ID<e73b55dc-f82e-4dd1-a9d1-9c11cdb4b69d@googlegroups.com>
In reply to#6651
Hi Johan and Karl!

When I replace the ' with CHR(39) I get the same error message: 

Error Code: adErrInvalidArgument
Subsystem: Vo2Ado
Error Subcode: 3001
Function: Find

I also tried Johan's tip. There is the same error message.
Maybe VO2Ado could not handle with more than two ' ??
eg: Find(Text = 'Hello'World')

Lu

[toc] | [prev] | [next] | [standalone]


#6653

FromMalcolm G <malcolm-news2012delete@delete.jobstream.com>
Date2014-03-11 12:34 +0000
Message-ID<9pDTu.53115$O_6.44550@fx04.am4>
In reply to#6652
On 11/03/2014 12:14, Lu wrote:
> Hi Johan and Karl!
> 
> When I replace the ' with CHR(39) I get the same error message: 
> 
> Error Code: adErrInvalidArgument
> Subsystem: Vo2Ado
> Error Subcode: 3001
> Function: Find
> 
> I also tried Johan's tip. There is the same error message.
> Maybe VO2Ado could not handle with more than two ' ??
> eg: Find(Text = 'Hello'World')

I would certainly expect that to be a syntax error - how would the layer
under vo2ado know where the search ended?

I think you are asking for the documentation on this method?

http://msdn.microsoft.com/en-us/library/windows/desktop/ms676117%28v=vs.85%29.aspx

I have not used the method but in most SQL contexts you escape a single
quote by doubling it - have you tried

("Text='+strtran(cText,"'","''")+ "'")

[toc] | [prev] | [next] | [standalone]


#6654

FromJohan Nel <johan.nel@xsinet.co.za>
Date2014-03-11 05:41 -0700
Message-ID<a26271d1-cf87-4a9b-b6c5-e7407637092a@googlegroups.com>
In reply to#6652
Hi Lu,

> I also tried Johan's tip. There is the same error message.
> eg: Find(Text = 'Hello'World')

Sorry but the above example is not what I posted.

First as I suggested do a:
  cText := "xxx"
  cTxt := 'Text="' + cText + "'" + '"'
  ?cTxt // Should show Text = "xxx'"

And you will get a compile error with what you showed us, since you have an unterminated string.  Remember the Find() method internally compile your string and that is unterminated, hence why at compile time you don't get an error message, but one at runtime.

Johan.

Your cTxt values

[toc] | [prev] | [next] | [standalone]


#6655

FromLu <lu2k@hotmail.com>
Date2014-03-12 00:49 -0700
Message-ID<b8c06dc2-17f4-4975-a4d7-a4c49e0ca1de@googlegroups.com>
In reply to#6654
Hi Johan and Malcolm,

When I use the double quotes (") and the showed text is: Text="xxx" I got the same error even if the text contains no single quote. When I use single quotes (eg: showed text: Text='xxx') I get no error, but the text could not contain single quotes.

I also used the tip from Malcolm with 2 single quotes but the same error message appears. 
The error message come always at runtime.

I noticed that I also get the error message when I allocate cText := "xxx" but I don't get the error message when I allocate cText with the bBrowser
cText := self:odcBrowser:Server:fieldget(#Text) when #Text contains no quotes 

Does it work at someone? We use VO2Ado 2.8 and bBrowser 3
Lu

[toc] | [prev] | [next] | [standalone]


#6656

FromJohan Nel <johan.nel@xsinet.co.za>
Date2014-03-12 01:29 -0700
Message-ID<fae1b826-cebd-4851-a7a9-ed2f985534e4@googlegroups.com>
In reply to#6655
Hi Lu,

Ok first things first.  You say ADO, what is the database that you interface to?  I assumed initially your Server object is DBF.

If it is a SQL database, the Find has to be SQL specific.  String delimiter is single quote, hence you need to double single quote to let the RDBMS understand it is a single quote embedded in the string.  You might also need to look at escaping the string depending your RDBMS e.g.
  cTxt := 'xxx\''
  cText := "Text = '" + cTxt + "'"

Try in that case:

cTxt := "xxx''" // Not double single quote in text
cText := "Text='" + cTxt + "'"
self:odcBrowser:Server:Find(cText)

HTH,

Johan.
On Wednesday, March 12, 2014 9:49:06 AM UTC+2, Lu wrote:
> Hi Johan and Malcolm,
> 
> 
> 
> When I use the double quotes (") and the showed text is: Text="xxx" I got the same error even if the text contains no single quote. When I use single quotes (eg: showed text: Text='xxx') I get no error, but the text could not contain single quotes.
> 
> 
> 
> I also used the tip from Malcolm with 2 single quotes but the same error message appears. 
> 
> The error message come always at runtime.
> 
> 
> 
> I noticed that I also get the error message when I allocate cText := "xxx" but I don't get the error message when I allocate cText with the bBrowser
> 
> cText := self:odcBrowser:Server:fieldget(#Text) when #Text contains no quotes 
> 
> 
> 
> Does it work at someone? We use VO2Ado 2.8 and bBrowser 3
> 
> Lu

[toc] | [prev] | [next] | [standalone]


#6657

FromJohan Nel <johan.nel@xsinet.co.za>
Date2014-03-12 01:34 -0700
Message-ID<2a5dbb9d-fd2e-4cbb-8a50-48d6b7adaf5c@googlegroups.com>
In reply to#6656
Made a typo, should have read:
   cTxt := "xxx\'"

> cTxt := "xxx''" // Not double single quote in text
This should read // Note the double single quote in text

Regards,

Johan.

[toc] | [prev] | [next] | [standalone]


#6658

FromMalcolm G <malcolm-news2012delete@delete.jobstream.com>
Date2014-03-12 09:29 +0000
Message-ID<BNVTu.58735$NB6.51257@fx35.am4>
In reply to#6655
On 12/03/2014 07:49, Lu wrote:
> Hi Johan and Malcolm,
> 
> When I use the double quotes (") and the showed text is: Text="xxx" I got the same error even if the text contains no single quote. When I use single quotes (eg: showed text: Text='xxx') I get no error, but the text could not contain single quotes.
> 
> I also used the tip from Malcolm with 2 single quotes but the same error message appears. 
> The error message come always at runtime.

so you mean you tried something like

"Text='my''search'"

?

I am afraid I don't use bbbrowser and I don't use ADO find so cannot test

[toc] | [prev] | [next] | [standalone]


#6659

FromLu <lu2k@hotmail.com>
Date2014-03-12 05:24 -0700
Message-ID<ac647d8f-237f-48f1-9554-8770a07699fd@googlegroups.com>
In reply to#6658
Now I know the problem. I tried the find statement in another window where the stored procedure - to fill the bBrowser - is called in another way. Now I get no error message :-)

Thanks for your help and patience

Lu

[toc] | [prev] | [next] | [standalone]


#6660

FromJohan Nel <johan.nel@xsinet.co.za>
Date2014-03-12 06:03 -0700
Message-ID<9a289304-7820-4e26-ad10-8d4d2b14cbbd@googlegroups.com>
In reply to#6659
Hi Lu,

> Now I know the problem. I tried the find statement in another window where the stored procedure - to fill the bBrowser - is called in another way. Now I get no error message :-)
> Thanks for your help and patience

Glad you got it working.  You welcome.

Regards,

Johan

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.clipper.visual-objects


csiph-web