Board index » delphi » missing query, table name or procedure name

missing query, table name or procedure name

elo,

i have following problem using TSQLConnection + TSQLQuery + TDataSetProvider
+ TClientDataSet + TDataSource
when i'm opening form there is:
"Missing query, table name or procedure name"
there is no error, when i set TSQLQuery's SQL property on design time.

so is it required to set TSQLQuery's SQL property on design time?
i prefer setting all sql queries in code.
i use the same SQLQuery component for "selects" and "inserts", "updates"
etc. so i have to set SQL property for "select" after every "insert",
"update" etc. anyhow.
in most forms it works fine but only one form doesn't want to work without
sql property beeing set during creating form.

how should i handle all this queries stuff to be sure that everything will
be all right at run time?

thanks in advance for any hints related to this problem,

michal talecki

 

Re:missing query, table name or procedure name


Quote
On Thu, 30 Jan 2003 20:27:43 +0100, "mik" <m...@x.0rg.pl> wrote:
>elo,

>i have following problem using TSQLConnection + TSQLQuery + TDataSetProvider
>+ TClientDataSet + TDataSource
>when i'm opening form there is:
>"Missing query, table name or procedure name"
>there is no error, when i set TSQLQuery's SQL property on design time.

>so is it required to set TSQLQuery's SQL property on design time?

No but you have to set the SQL property before you open the
ClientDataSet or the SQLQuery.

Quote
>i prefer setting all sql queries in code.
>i use the same SQLQuery component for "selects" and "inserts", "updates"
>etc. so i have to set SQL property for "select" after every "insert",

I would not use the SQLQuery that is connected to the DataSetProvider
for any other purpose. Use a second SQLQuery component for your INSERT
and UPDATE statements.

--
Bill (TeamB)
(TeamB cannot respond to questions received via email)

Re:missing query, table name or procedure name


Quote
"Bill Todd" <b...@notthis.dbginc.com> wrote in message >
> >so is it required to set TSQLQuery's SQL property on design time?
> No but you have to set the SQL property before you open the
> ClientDataSet or the SQLQuery.

i do it like that. this (probably) causes the error but it doesn't open
anything before setting SQL property (?)

  QueryRoutes.Close;
  QueryRoutes.SQL.Clear;
  QueryRoutes.SQL.Add('SELECT id_route FROM routes');
  QueryRoutes.Open;
  ClientRoutes.Open;
  ClientRoutes.Refresh;

i do Client.Open and Client.Refresh everytime i'am refreshing view. is it
ok? because only this way i found clientdataset working fine but it doesn't
seem nice. (may be doing inserts and updates on same sqlquery as selects
automaticaly closes clientdataset and i have to open it again?)

Quote
> >i prefer setting all sql queries in code.
> >i use the same SQLQuery component for "selects" and "inserts", "updates"
> >etc. so i have to set SQL property for "select" after every "insert",
> I would not use the SQLQuery that is connected to the DataSetProvider
> for any other purpose. Use a second SQLQuery component for your INSERT
> and UPDATE statements.

so it isn't good idea to use the same query for few SELECTs (with other set
of fields) too, is it?

thanks very much for your advice.

--
michal talecki

p.s. i'm sorry if my questions are too trivial but i couldn't find answers
anywhere else.

Re:missing query, table name or procedure name


Change your code to:

  QueryRoutes.SQL.Clear;
  QueryRoutes.SQL.Add('SELECT id_route FROM routes');
  ClientRoutes.Open;

and make sure the query is closed at design time. When you open the
CDS the DataSetProvider will open the query, send the records to the
CDS and close the query automatically.

--
Bill (TeamB)
(TeamB cannot respond to questions received via email)

Re:missing query, table name or procedure name


Quote
"Bill Todd" <b...@notthis.dbginc.com> wrote in message
>   QueryRoutes.SQL.Clear;
>   QueryRoutes.SQL.Add('SELECT id_route FROM routes');
>   ClientRoutes.Open;
> and make sure the query is closed at design time. When you open the
> CDS the DataSetProvider will open the query, send the records to the
> CDS and close the query automatically.

i call this routine everytime i want fresh data in datasource.
it seems like ClientRoutes needs to be closed before (or after) reloading
query's sql property anyway.
if i don't call ClientRoutes.Close before these 3 lines you wrote, client
won't have fresh data.

--
michal talecki

Re:missing query, table name or procedure name


If you want to refresh the data in the ClientDataSet all you have to
do is call ClientDataSet.Refresh. Calling Refresh will rerun the query
and load the new data into the CDS.

Quote
On Fri, 31 Jan 2003 04:26:58 +0100, "mik" <m...@x.0rg.pl> wrote:
>"Bill Todd" <b...@notthis.dbginc.com> wrote in message

>>   QueryRoutes.SQL.Clear;
>>   QueryRoutes.SQL.Add('SELECT id_route FROM routes');
>>   ClientRoutes.Open;
>> and make sure the query is closed at design time. When you open the
>> CDS the DataSetProvider will open the query, send the records to the
>> CDS and close the query automatically.

>i call this routine everytime i want fresh data in datasource.
>it seems like ClientRoutes needs to be closed before (or after) reloading
>query's sql property anyway.
>if i don't call ClientRoutes.Close before these 3 lines you wrote, client
>won't have fresh data.

--
Bill (TeamB)
(TeamB cannot respond to questions received via email)

Other Threads