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 

Help on sql

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder Databases (Desktop)
View previous topic :: View next topic  
Author Message
Ab. Aziz
Guest





PostPosted: Mon Oct 20, 2003 7:49 am    Post subject: Help on sql Reply with quote



i had try the following sql statement at sql explorer:-

select * from v_avg_per_day where "average_duration" > 600

and i try do the samething at borland C++ 6.0 with the following step

1) I have SQLConnection
2) I have SQLQuery
3) and i define SQLQuery->SQL->"select * from v_avg_per_day"
4) ButtonClick1
inside buttonClick i put the following code :-

SQLQuery1->Close();
SQLQuery1->SQL->Clear();
SQLQuery1->SQL->Add("where ""average_per_day"" > 600");
DataModule2->SQLQuery1->Open();
DataModule2->ClientDataSet1->Refresh();

when runnning the code and i click the button i got this message
"average_per_day" is valid identifier"


Back to top
Alex Croes
Guest





PostPosted: Mon Oct 20, 2003 7:23 pm    Post subject: Re: Help on sql Reply with quote



Ab. Aziz wrote:

Quote:
SQLQuery1->Close();
SQLQuery1->SQL->Clear();
SQLQuery1->SQL->Add("where ""average_per_day"" > 600");
SQLQuery1 -> SQL -> ADD("WHERE "average_per_day" > 600");



Alex


Back to top
Jayme Jeffman Filho
Guest





PostPosted: Wed Oct 22, 2003 1:24 pm    Post subject: Re: Help on sql Reply with quote



Hi Aziz,

Remember that every time you call the TQuery->SQL->Clear() method you are
erasing all the SQL lines, so your query will be set to the next Add method
call. If you call the Open method to a query defined as "where variable >
value" you'll get an SQL syntax error.

Fields without spaces do not need to be quoted.

HTH

Jayme.

"Ab. Aziz" <aziz (AT) rndtm (DOT) net.my> escreveu na mensagem
news:3f93939c (AT) newsgroups (DOT) borland.com...
Quote:
i had try the following sql statement at sql explorer:-

select * from v_avg_per_day where "average_duration" > 600

and i try do the samething at borland C++ 6.0 with the following step

1) I have SQLConnection
2) I have SQLQuery
3) and i define SQLQuery->SQL->"select * from v_avg_per_day"
4) ButtonClick1
inside buttonClick i put the following code :-

SQLQuery1->Close();
SQLQuery1->SQL->Clear();
SQLQuery1->SQL->Add("where ""average_per_day"" > 600");
DataModule2->SQLQuery1->Open();
DataModule2->ClientDataSet1->Refresh();

when runnning the code and i click the button i got this message
"average_per_day" is valid identifier"





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