BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

TClientDataSet Lookup Error 'Unterminated string constant'

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Databases (Multi-Tier)
View previous topic :: View next topic  
Author Message
Alex
Guest





PostPosted: Sun Jul 27, 2003 3:19 pm    Post subject: TClientDataSet Lookup Error 'Unterminated string constant' Reply with quote




Hi everybody.

There seems to be an error in the TClientDataSet.Lookup method.
If I lookup for this string: '
(only one quotation mark) the error 'Unterminated string constant' is raised (I hope it's translated right, the German message is 'Nicht begrenzte Stringkonstante')

If I lookup for this string: '1
the error 'Arithmetical filter expressions are not supported' is raised. (German: 'Arithmetische Filterausdrücke weden nicht unterstützt')

Anybody heard about this problem and can help me to get around this problem.

Thanks.

Back to top
Wayne Niddery [TeamB]
Guest





PostPosted: Mon Jul 28, 2003 4:10 am    Post subject: Re: TClientDataSet Lookup Error 'Unterminated string constan Reply with quote



Alex wrote:
Quote:

There seems to be an error in the TClientDataSet.Lookup method.
If I lookup for this string: '
(only one quotation mark) the error 'Unterminated string constant' is
raised (I hope it's translated right, the German message is 'Nicht
begrenzte Stringkonstante')

If I lookup for this string: '1
the error 'Arithmetical filter expressions are not supported' is
raised. (German: 'Arithmetische Filterausdrücke weden nicht
unterstützt')

If your search string contains an apostrophe then you must double it up
since it conflicts with the character the compiler needs to delimit strings.
Easiest way is to use the QuotedStr function:

s := QuotedStr(SomeStringVar);

--
Wayne Niddery - Logic Fundamentals, Inc. (www.logicfundamentals.com)
RADBooks: http://www.logicfundamentals.com/RADBooks/delphibooks.html
Those who disdain wealth as a worthy goal for an individual or a
society seem not to realize that wealth is the only thing that can
prevent poverty. - Thomas Sowell




Back to top
Marco Azevedo
Guest





PostPosted: Mon Jul 28, 2003 4:28 am    Post subject: Re: TClientDataSet Lookup Error 'Unterminated string constan Reply with quote





I cannot understand what's your problem. But here you are a lookup example:

ClientDataSet1.Lookup('Codigo;descricao',VarArrayOf([Edit1.Text,Edit2.Text]),'Valor');

If it does not solve your problem, send more details. Maybe the line where the error occurs.


Have fun !

Marco




"Alex" <dragor (AT) arcor (DOT) de> wrote:
Quote:

Hi everybody.

There seems to be an error in the TClientDataSet.Lookup method.
If I lookup for this string: '
(only one quotation mark) the error 'Unterminated string constant' is raised (I hope it's translated right, the German message is 'Nicht begrenzte Stringkonstante')

If I lookup for this string: '1
the error 'Arithmetical filter expressions are not supported' is raised. (German: 'Arithmetische Filterausdrücke weden nicht unterstützt')

Anybody heard about this problem and can help me to get around this problem.

Thanks.


Back to top
Alex
Guest





PostPosted: Mon Jul 28, 2003 5:57 pm    Post subject: Re: TClientDataSet Lookup Error 'Unterminated string constan Reply with quote

----- Original Message -----
From: "Wayne Niddery [TeamB]" [email]wniddery (AT) chaff (DOT) aci.on.ca[/email]

Quote:
If your search string contains an apostrophe then you must double it up
since it conflicts with the character the compiler needs to delimit
strings.
Easiest way is to use the QuotedStr function:

s := QuotedStr(SomeStringVar);


My Problem is not one apostrophe in a string. It seems that the lookup
method have problems with one apostrophe at the beginning and/or at the end
of a string.
I tested the behaviour with the following strings :
(NOTE: I write the strings like they appear in the DBGrid. Then I'm using
these DBGrid strings for looking up in the ClientDataset)

Test string 1: abc => OK
2: abc's => OK
3: 'abc => OK
4: abc' => Error: Unterminated string constant
5: 'abc' => Error: Faulty terminated filter
expression
6: 'abc's' => Error: Faulty terminated filter
expression
7: 'abc's => Error: Faulty terminated filter
expression
8: 4abc => OK
9: 4abc's => OK
10: '4abc => Error: Arithmetical filter expressions
are not supported
11: '4abc's => Error: Arithmetical filter expressions
are not supported
12: 4abc's' => Error: Faulty terminated filter
expression
13: 4abc' => Error: Unterminated string constant





Back to top
Alex
Guest





PostPosted: Mon Jul 28, 2003 5:57 pm    Post subject: Re: TClientDataSet Lookup Error 'Unterminated string constan Reply with quote

----- Original Message -----
From: "Wayne Niddery [TeamB]" [email]wniddery (AT) chaff (DOT) aci.on.ca[/email]

Quote:
If your search string contains an apostrophe then you must double it up
since it conflicts with the character the compiler needs to delimit
strings.
Easiest way is to use the QuotedStr function:

s := QuotedStr(SomeStringVar);


My Problem is not one apostrophe in a string. It seems that the lookup
method have problems with one apostrophe at the beginning and/or at the end
of a string.
I tested the behaviour with the following strings :
(NOTE: I write the strings like they appear in the DBGrid. Then I'm using
these DBGrid strings for looking up in the ClientDataset)

Test string 1: abc => OK
2: abc's => OK
3: 'abc => OK
4: abc' => Error: Unterminated string constant
5: 'abc' => Error: Faulty terminated filter
expression
6: 'abc's' => Error: Faulty terminated filter
expression
7: 'abc's => Error: Faulty terminated filter
expression
8: 4abc => OK
9: 4abc's => OK
10: '4abc => Error: Arithmetical filter expressions
are not supported
11: '4abc's => Error: Arithmetical filter expressions
are not supported
12: 4abc's' => Error: Faulty terminated filter
expression
13: 4abc' => Error: Unterminated string constant





Back to top
Wayne Niddery [TeamB]
Guest





PostPosted: Tue Jul 29, 2003 1:07 am    Post subject: Re: TClientDataSet Lookup Error 'Unterminated string constan Reply with quote

Alex wrote:
Quote:

My Problem is not one apostrophe in a string. It seems that the lookup
method have problems with one apostrophe at the beginning and/or at
the end of a string.
I tested the behaviour with the following strings :
(NOTE: I write the strings like they appear in the DBGrid. Then I'm
using these DBGrid strings for looking up in the ClientDataset)

Test string 1: abc => OK
2: abc's => OK
3: 'abc => OK
4: abc' => Error: Unterminated string
constant 5: 'abc' => Error: Faulty
terminated filter
expression
6: 'abc's' => Error: Faulty terminated filter
expression
7: 'abc's => Error: Faulty terminated filter
expression

I'm surprised #2 or 3 is ok. It should still be the same issue, you need to
use QuotedStr on these. E.g. to do a filter using #2, it should look like:

Filter := 'name=''abc''s'''; // all single quotes

If abc's is already in a string variable then you need to do this:

Filter := 'name=' + QuotedStr(somevar);

--
Wayne Niddery - Logic Fundamentals, Inc. (www.logicfundamentals.com)
RADBooks: http://www.logicfundamentals.com/RADBooks/delphibooks.html
Those who disdain wealth as a worthy goal for an individual or a
society seem not to realize that wealth is the only thing that can
prevent poverty. - Thomas Sowell




Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Databases (Multi-Tier) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.