| View previous topic :: View next topic |
| Author |
Message |
Ab. Aziz Guest
|
Posted: Mon Oct 20, 2003 7:49 am Post subject: Help on sql |
|
|
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
|
Posted: Mon Oct 20, 2003 7:23 pm Post subject: Re: Help on sql |
|
|
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
|
Posted: Wed Oct 22, 2003 1:24 pm Post subject: Re: Help on sql |
|
|
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 |
|
 |
|