Board index » delphi » How to Query View in SQLClientDataSet

How to Query View in SQLClientDataSet


2004-05-24 10:01:11 PM
delphi18
I've created a view in Interbase but when I try to query the view in my SQLClientDataset, it tells me that the table doesn't exist. When I look at the CommandText Editor for the CommandText property , the view doesn't show there either. My SQLConnection's TableScope.tsView is set to True. How can I query my View?
Thanks in Advance!
-Brian
 
 

Re:How to Query View in SQLClientDataSet

Brian Thomas writes:
Quote
I've created a view in Interbase but when I try to query the view in
my SQLClientDataset, it tells me that the table doesn't exist. When I
look at the CommandText Editor for the CommandText property , the
view doesn't show there either. My SQLConnection's TableScope.tsView
is set to True. How can I query my View?
The TXXXClientDatasets (i.e. the ClientDataset/Provider/native Dataset
combination components) are all deprecated and should not be used. Use a
separate ClientDataset, Provider, and SQLDataset instead.
--
Wayne Niddery - Logic Fundamentals, Inc. (www.logicfundamentals.com)
RADBooks: www.logicfundamentals.com/RADBooks.html
"True peace is not the absence of tension, but the presence of
justice." - Martin Luther King, Jr.
 

Re:How to Query View in SQLClientDataSet

Thanks Wayne for the advice but that still doesn't lead me to my answer. Even if I use a SQLDataset and set the command text to 'SELECT * FROM MY_VIEW', I still get the error that 'MY_VIEW' does not exist. How can I query my view. I have also tried setting the SQLDataset as a Table but 'MY_VIEW' doesn't show up in the list.
Please Help!
Thanks.
-Brian
"Wayne Niddery [TeamB]" <XXXX@XXXXX.COM>writes:
Quote
Brian Thomas writes:
>I've created a view in Interbase but when I try to query the view in
>my SQLClientDataset, it tells me that the table doesn't exist. When I
>look at the CommandText Editor for the CommandText property , the
>view doesn't show there either. My SQLConnection's TableScope.tsView
>is set to True. How can I query my View?

The TXXXClientDatasets (i.e. the ClientDataset/Provider/native Dataset
combination components) are all deprecated and should not be used. Use a
separate ClientDataset, Provider, and SQLDataset instead.


--
Wayne Niddery - Logic Fundamentals, Inc. (www.logicfundamentals.com)
RADBooks: www.logicfundamentals.com/RADBooks.html
"True peace is not the absence of tension, but the presence of
justice." - Martin Luther King, Jr.


 

Re:How to Query View in SQLClientDataSet

Brian Thomas writes:
Quote
Thanks Wayne for the advice but that still doesn't lead me to my
answer. Even if I use a SQLDataset and set the command text to
'SELECT * FROM MY_VIEW', I still get the error that 'MY_VIEW' does
not exist. How can I query my view. I have also tried setting the
SQLDataset as a Table but 'MY_VIEW' doesn't show up in the list.
Can you run the same query in IBConsole?
-Craig
--
Craig Stuntz [TeamB] . Vertex Systems Corp. . Columbus, OH
Delphi/InterBase Weblog : delphi.weblogs.com
Useful articles about InterBase and Delphi development:
delphi.weblogs.com/articles
 

Re:How to Query View in SQLClientDataSet

Yes.
"Craig Stuntz [TeamB]" <XXXX@XXXXX.COM [a.k.a. vertexsoftware.com]>writes:
Quote
Brian Thomas writes:

>Thanks Wayne for the advice but that still doesn't lead me to my
>answer. Even if I use a SQLDataset and set the command text to
>'SELECT * FROM MY_VIEW', I still get the error that 'MY_VIEW' does
>not exist. How can I query my view. I have also tried setting the
>SQLDataset as a Table but 'MY_VIEW' doesn't show up in the list.

Can you run the same query in IBConsole?

-Craig

--
Craig Stuntz [TeamB] . Vertex Systems Corp. . Columbus, OH
Delphi/InterBase Weblog : delphi.weblogs.com
Useful articles about InterBase and Delphi development:
delphi.weblogs.com/articles
 

Re:How to Query View in SQLClientDataSet

Brian Thomas writes:
Quote
Yes.
Did you perchance create the VIEW with delimited identifiers? This
would make the name case-sensitive.
-Craig
--
Craig Stuntz [TeamB] . Vertex Systems Corp. . Columbus, OH
Delphi/InterBase Weblog : delphi.weblogs.com
IB 6 versions prior to 6.0.1.6 are pre-release and may corrupt
your DBs! Open Edition users, get 6.0.1.6 from mers.com
 

Re:How to Query View in SQLClientDataSet

I'm not sure what that means exactly. I am assuming you're meaning the specified field names (e.g., create view( field1, field2) as.. ).
Anyway, the view is now showing in the table list but I am not exactly sure why. All I did was look at the sqlConnection component's properties, especially the path to my database. I didn't make any changes except that I set the connected property to false. Note, I created this view last week and have been in and out of Delphi ever since. I closed Delphi after saving my project, opened it up, and my view was there, along with another table that wasn't showing up. I don't understand what happend I can assure you that I made no changes to the db path. The only thing I can think of is that by looking at the properties, something got refreshed in the sqlconnection.
Thank you.
-Brian
"Craig Stuntz [TeamB]" <XXXX@XXXXX.COM [a.k.a. vertexsoftware.com]>writes:
Quote
Brian Thomas writes:

>Yes.

Did you perchance create the VIEW with delimited identifiers? This
would make the name case-sensitive.

-Craig

--
Craig Stuntz [TeamB] . Vertex Systems Corp. . Columbus, OH
Delphi/InterBase Weblog : delphi.weblogs.com
IB 6 versions prior to 6.0.1.6 are pre-release and may corrupt
your DBs! Open Edition users, get 6.0.1.6 from mers.com
 

Re:How to Query View in SQLClientDataSet

Brian Thomas writes:
Quote

Anyway, the view is now showing in the table list but I am not exactly
sure why. All I did was look at the sqlConnection component's
properties, especially the path to my database. I didn't make any
changes except that I set the connected property to false. Note, I
created this view last week and have been in and out of Delphi ever
since. I closed Delphi after saving my project, opened it up, and my
view was there, along with another table that wasn't showing up.
Very strange. If this comes up again and you can record reproducible steps,
please enter it into QC.
--
Wayne Niddery - Logic Fundamentals, Inc. (www.logicfundamentals.com)
RADBooks: www.logicfundamentals.com/RADBooks.html
"True peace is not the absence of tension, but the presence of
justice." - Martin Luther King, Jr.