ADO Query -- always doing a SELECT *


2004-02-04 06:52:43 AM
delphi242
Using Delphi 6 and retrieving data from DB2.
Please help me understand why the DB2 trace is showing SQL statements
"Select *..." after what I think are well constructed SELECT statements.
The TAdoQuery is setup / run by doing the following (left out the create
parts)...
1. MyAdoQuery.Connection := ADOConnection;
2. The Connect String is set for the ADOConnection
3. ADOConnection.Connect := True;
4. MyAdoQuery.SQL.Text := 'SELECT FirstName FROM Employee WHERE (SSN =
123456789)'
5. MyAdoQuery.Open;
6. MyAdoQuery.Close;
7. --- DB2 now runs "SELECT * FROM Employee"
8. MyAdoQuery.SQL.Text := 'SELECT Prod1Cost FROM ProductTable WHERE (ProdID
= 42)'
9. MyAdoQuery.Open;
10. MyAdoQuery.Close;
11. --- DB2 now runs "SELECT * FROM ProductTable"
What I know...
** The trace statements show "SQLPrepareW" at the beginning of the lines
when running my Delphi 6 app.
*** The trace statements show "SQLExecDirectW" at the beginning of the lines
when running the same SQL statement through Borland's SQL Explorer AND I do
NOT get the "SELECT *..." afterwards.
**** Running the same SQL from a VB(Visual Basic) app using an ADO Recordset does NOT
produce the "SELECT *..." afterwards.
Am I missing something really simple?
Please help.
Thank you,
Samson