Board index » delphi » TSQLConnection in D7

TSQLConnection in D7


2007-03-30 02:09:53 AM
delphi279
I am having some trouble with a TSQLDataSet in Delphi 7.
When I use the SQL Command below directly in MS SQL or any other utility that accepts SQL commands, I get the appropriate output. When I try it with my TSQLDataSet, it tell me that the Table (_SMDBA_._WORKORD_) is not found. I have tried putting double quotes around each element (e.g., "_SMDBA"."_WORKORD_") separately and together. I even did a cut & paste to make sure my ststement is correct. Nothing helps. I checked my TSQLConnection and everything appears correctly there as well. I just don't understand why it can not recognize my Table Name. Any suggestions?
txtSqlCommand := 'SELECT A.SEQUENCE,A."DATE OPEN",A."CLOSED ON",A.STATUS,A.DESCRIPTION,A.RESOLUTION FROM "_SMDBA_"."_WORKORD_" A WHERE A.WO_CCTXT01 = ' + 'CMMAPPS' + ' ORDER BY A."DATE OPEN" DESC, A.SEQUENCE';
 
 

Re:TSQLConnection in D7

"Dennis Courtney" <XXXX@XXXXX.COM>writes
Quote

I am having some trouble with a TSQLDataSet in Delphi 7.
When I use the SQL Command below directly in MS SQL or any other utility
that accepts SQL commands, I get the appropriate output. When I try it with
my TSQLDataSet, it tell me that the Table (_SMDBA_._WORKORD_) is not found.
I've tried putting double quotes around each element (e.g.,
"_SMDBA"."_WORKORD_") separately and together. I even did a cut & paste to
make sure my ststement is correct. Nothing helps. I checked my
TSQLConnection and everything appears correctly there as well. I just don't
understand why it can not recognize my Table Name. Any suggestions?
Quote

txtSqlCommand := 'SELECT A.SEQUENCE,A."DATE OPEN",A."CLOSED
ON",A.STATUS,A.DESCRIPTION,A.RESOLUTION FROM "_SMDBA_"."_WORKORD_" A WHERE
A.WO_CCTXT01 = ' + 'CMMAPPS' + ' ORDER BY A."DATE OPEN" DESC, A.SEQUENCE';
I once had this same problem trying to connect to someone's Access tables.
Believe it or not the syntax that worked was the equivalent of:
from [_SMDBA_].[_WORKORD_]
(use square brackets instead of double quote)
Maybe that will work for you?
Cheers,
EdB