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 

it's awful...

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Databases (ADO)
View previous topic :: View next topic  
Author Message
Vlad Gonchar
Guest





PostPosted: Wed Feb 18, 2004 6:59 pm    Post subject: it's awful... Reply with quote



The following code

aQuery := TAdoQuery.Create;
aQuery.Sql.Add('select ObjId from pbvObjects');
aQuery.Sql.Add('where Object_Kind=123');
aQuery.Sql.Add('and not (ObjId>=-50'));
aQuery.Sql.Add('and ObjId<=50)');
aQuery.Sql.Add('Order by ObjId');
aQuery.Open;

fails at Oracle 8i with message like "There is not right parentheses" at
NT4, but works at WinXP, W2K...
Merge lines 3 and 4:

aQuery := TAdoQuery.Create;
aQuery.Sql.Add('select ObjId from pbvObjects');
aQuery.Sql.Add('where Object_Kind=123');
aQuery.Sql.Add('and not (ObjId>=-50 and ObjId<=50)');
aQuery.Sql.Add('Order by ObjId');
aQuery.Open;

It works?! Is anybody aware about this ? What's the reason ?




Back to top
Kevin Frevert
Guest





PostPosted: Wed Feb 18, 2004 7:06 pm    Post subject: Re: it's awful... Reply with quote



"Vlad Gonchar" <VladG (AT) Frogware (DOT) com> wrote

Quote:

It works?! Is anybody aware about this ? What's the reason ?

aQuery.Sql.Add('and not (ObjId>=-50'));

Try... aQuery.Sql.Add('and not (ObjId >= 50)');

krf



Back to top
Vlad Gonchar
Guest





PostPosted: Wed Feb 18, 2004 8:12 pm    Post subject: Re: it's awful... Reply with quote



It is slip of fingers. Correct line is

aQuery.Sql.Add('and not (ObjId>=-50');



Back to top
Kevin Frevert
Guest





PostPosted: Wed Feb 18, 2004 8:21 pm    Post subject: Re: it's awful... Reply with quote

Did that take care of it or are you still getting an error?

krf

"Vlad Gonchar" <VladG (AT) Frogware (DOT) com> wrote

Quote:
It is slip of fingers. Correct line is

aQuery.Sql.Add('and not (ObjId>=-50');






Back to top
Vitali Kalinin
Guest





PostPosted: Thu Feb 19, 2004 10:36 am    Post subject: Re: it's awful... Reply with quote

Always enclose such code with Sql.BeginUpdate Sql.EndUpdate pair
"Vlad Gonchar" <VladG (AT) Frogware (DOT) com> сообщил/сообщила в новостях следующее:
news:4033b609$1 (AT) newsgroups (DOT) borland.com...
Quote:
The following code

aQuery := TAdoQuery.Create;
aQuery.Sql.Add('select ObjId from pbvObjects');
aQuery.Sql.Add('where Object_Kind=123');
aQuery.Sql.Add('and not (ObjId>=-50'));
aQuery.Sql.Add('and ObjId<=50)');
aQuery.Sql.Add('Order by ObjId');
aQuery.Open;

fails at Oracle 8i with message like "There is not right parentheses" at
NT4, but works at WinXP, W2K...
Merge lines 3 and 4:

aQuery := TAdoQuery.Create;
aQuery.Sql.Add('select ObjId from pbvObjects');
aQuery.Sql.Add('where Object_Kind=123');
aQuery.Sql.Add('and not (ObjId>=-50 and ObjId<=50)');
aQuery.Sql.Add('Order by ObjId');
aQuery.Open;

It works?! Is anybody aware about this ? What's the reason ?







Back to top
Vlad Gonchar
Guest





PostPosted: Thu Feb 19, 2004 1:58 pm    Post subject: Re: it's awful... Reply with quote

Quote:
Did that take care of it or are you still getting an error?

No, it doesn not work. I did the mistake when typing the question.
But the metter is still there.




Back to top
Vlad Gonchar
Guest





PostPosted: Thu Feb 19, 2004 3:16 pm    Post subject: Re: it's awful... Reply with quote

Quote:
Always enclose such code with Sql.BeginUpdate Sql.EndUpdate pair

Thank you, Vitalik



Back to top
Kevin Frevert
Guest





PostPosted: Thu Feb 19, 2004 3:25 pm    Post subject: Re: it's awful... Reply with quote

OK, just wanted to make sure. Have you tried saving the SQL to a file and
running it in an Oracle query tool (just to be 100% sure all the parenthesis
match)?

You could simply set up the query at design time (write/test the code in
your favorite query tool, copy into the component) and open at runtime.
IMO, it saves a whole lot of time 6 months from now when (not if) users want
something changed.

Good luck,
krf

"Vlad Gonchar" <VladG (AT) Frogware (DOT) com> wrote

Quote:
Did that take care of it or are you still getting an error?

No, it doesn not work. I did the mistake when typing the question.
But the metter is still there.






Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Databases (ADO) 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.