|
Home > Archive > Programming with dBASE > February 2006 > select from non alias
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
select from non alias
|
|
| Charlie Lutz 2006-02-15, 8:23 pm |
| I need to open up a table in a folder that is not part of any BDE alias
as part of a select statment. Can't get it to work. To add to the
confusion I am trying to change folders on the fly with a varable.
cPath is something like "MVN", a folder name
q = new query()
q.sql = "select * from C:\data\dbase\odd\te
mp\&cPATH\dcgen.dbf"
--- this throws an error
q.active = true
Thanks,
Charlie
--
____________________
________
Charlie Lutz
#1000441
| |
| Paul Van House 2006-02-15, 8:23 pm |
| In article <MPG. 1e5d564f136e33f59896
cd@news.dbase.com>, Charlie Lutz
<lutzc@(remove)wes.army.mil> says...
> I need to open up a table in a folder that is not part of any BDE alias
> as part of a select statment. Can't get it to work. To add to the
> confusion I am trying to change folders on the fly with a varable.
> cPath is something like "MVN", a folder name
>
> q = new query()
> q.sql = "select * from C:\data\dbase\odd\te
mp\&cPATH\dcgen.dbf"
> --- this throws an error
> q.active = true
>
> Thanks,
> Charlie
>
>
If you hard code a path, you need to enclose it in double quotes.
I'm not sure if it will work with Macro substitution (&cPATH) assuming
that's what you're trying to do.
q = new query()
q.sql = [select * from " C:\data\dbase\odd\te
mp\&cPATH\dcgen.dbf"]
q.active = true
--
Paul Van House
remove ".removeme" for e-mail replies
Radio/TV Software and Baseball Stat Software:
http://www.binxsoftware.com
Family Home Page: http://vanhouse.binxsoftware.com
Church Home Page: http://www.ashfordumc.org
| |
| Ken Mayer [dBVIPS] 2006-02-15, 8:23 pm |
| Charlie Lutz wrote:
> I need to open up a table in a folder that is not part of any BDE alias
> as part of a select statment. Can't get it to work. To add to the
> confusion I am trying to change folders on the fly with a varable.
> cPath is something like "MVN", a folder name
>
> q = new query()
> q.sql = "select * from C:\data\dbase\odd\te
mp\&cPATH\dcgen.dbf"
q.sql = [select * from 'C:\data\dbase\odd\t
emp\]+cPATH+[\dcgen.dbf']
I put quotes around paths just to deal with possible spaces (single
quotes for SQL), and then use the brackets to delimit the whole statement.
No need to make a macro out of this ...
Ken
--
/(Opinions expressed are purely my own, not those of dataBased
Intelligence, Inc.)/
*Ken Mayer* [dBVIPS]
/Golden Stag Productions/
dBASE at goldenstag dot net
http://www.goldenstag.net/dbase/dBASEBook.htm
http://www.goldenstag.net/GSP
http://www.goldenstag.net/dbase
| |
| Charlie Lutz 2006-02-16, 7:23 am |
| In article <NGKZq2nMGHA.1152@news-server>, dbase@_nospam_golden
stag.net
says...[color=darkred]
> Charlie Lutz wrote:
Thanks Ken and Paul,
I figured it was a "quote" issue, but I can never seem to find the
correct syntax for these things.
Charlie
--
____________________
________
Charlie Lutz
#1000441
| |
| Charlie Lutz 2006-02-17, 7:24 am |
| In article <NGKZq2nMGHA.1152@news-server>, dbase@_nospam_golden
stag.net
says...[color=darkred]
> Charlie Lutz wrote:
q.sql = [select * from 'C:\data\dbase\odd\t
emp\]+cPATH+[\dcgen.dbf']
OK Ken, I hate to be dense but... here is a similar question. I can't
seem to find the right combination here either:
drop table C:\data\dbase\temp\+
cPath+\dcgen.dbf
Someday I will get this stuff straight.
Thanks,
Charlie
--
____________________
________
Charlie Lutz
#1000441
| |
| Jan Hoelterling 2006-02-17, 7:24 am |
| Hi Charlie,
seems you're mixing two different concepts here...
Whenever you're dealing with OOP and properties, it's just STRINGS, so you
just need to build the string right and you're in business. That's what Ken
was showing - no need for macro substitution, because you're dealing with a
plain string.
However, on statements like USE, CREATE TABLE, ALTER TABLE, DROP TABLE etc,
you're looking at complete commands that can *not* deal with strings. In
your particular example, you could take two approaches:
DT = & #91;C:\data\dbase\te
mp\]+cPath+[\dcgen.dbf]
DROP TABLE &DT.
Now, that *should* work, but if there is a problem with this (for example, a
space in the path name above would make this blow up), it's very hard to
troubleshoot. That's why for commands that require macro substitution for a
table name, I always build the *complete* command in a string, then execute
that. Since I can display the complete string, it's much easier to work out
bugs:
MyCommand = [Drop Table " C:\data\dbase\temp\]
+cPath+[\dcgen.dbf"]
?"My Command is: ",MyCommand
&MyCommand.
Please also note - the period serves as a macro terminator. I personally
think it also helps readability to always include it, that's why in the
above, there is a period after MyCommand.
Hope this helps,
Jan
| |
| Charlie Lutz 2006-02-17, 9:23 am |
| In article <Im3Frs0MGHA.1148@news-server>, jan@hoelterling.com says...
> seems you're mixing two different concepts here...
I am good at doing that!
>
>
Jan,
That is a great explanation. Maybe it will even sink into my thick
skull. Much appreciated.
Thanks
Charlie
--
____________________
________
Charlie Lutz
#1000441
| |
| Jan Hoelterling 2006-02-17, 9:23 am |
| Glad to help!
Jan
|
|
|
|
|