Home > Archive > FoxPro database connector > March 2006 > Select SQL









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 SQL
Charly Pruemm

2006-03-06, 7:31 pm

What is the difference between these 2 possibilities?

pcDatapath is the direcory where myDatabase and tables are stored..!

1.)

if !dbused('MyDatabase'
)
open database (pcDatapath+'MyDatab
ase') shared
endif
set database to myDatabase

select * from myDatabase!customers
where state='Michigan' into cursor
curCustumers

versus:

2.) Dont open the database but:

select * from (pcDatapath+'custome
rs') where state='Michigan' into cursor
curCustumers

Query the table directly over its path and tablename


Thanks for advises

CHARLY


Dan Freeman

2006-03-06, 7:31 pm

No functional difference at all.

Some will give you style points for going one way over the other. (My
preference is to let the database keep track of where its tables are.)
That's about it.

Just be aware that by directly referencing the table, the dbc will be opened
automatically.

Dan


Charly Pruemm wrote:
> What is the difference between these 2 possibilities?
>
> pcDatapath is the direcory where myDatabase and tables are stored..!
>
> 1.)
>
> if !dbused('MyDatabase'
)
> open database (pcDatapath+'MyDatab
ase') shared
> endif
> set database to myDatabase
>
> select * from myDatabase!customers
where state='Michigan' into cursor
> curCustumers
>
> versus:
>
> 2.) Dont open the database but:
>
> select * from (pcDatapath+'custome
rs') where state='Michigan' into
> cursor curCustumers
>
> Query the table directly over its path and tablename
>
>
> Thanks for advises
>
> CHARLY



Craig Berntson

2006-03-06, 7:31 pm

Unless you have SET EXCLUSIVE OFF, the first method will open the DBC shared
and the table exclusive. The second method will open both the DBC and the
DBF exclusive.

--
Craig Berntson
MCSD, Visual FoxPro MVP
www.craigberntson.com
Salt Lake City Fox User Group
www.slcfox.org
www.foxcentral.net


"Charly Pruemm" <kpruemm@t-online.de> wrote in message
news:du9k5t$4v1$01$1
@news.t-online.com...
> What is the difference between these 2 possibilities?
>
> pcDatapath is the direcory where myDatabase and tables are stored..!
>
> 1.)
>
> if !dbused('MyDatabase'
)
> open database (pcDatapath+'MyDatab
ase') shared
> endif
> set database to myDatabase
>
> select * from myDatabase!customers
where state='Michigan' into cursor
> curCustumers
>
> versus:
>
> 2.) Dont open the database but:
>
> select * from (pcDatapath+'custome
rs') where state='Michigan' into cursor
> curCustumers
>
> Query the table directly over its path and tablename
>
>
> Thanks for advises
>
> CHARLY
>
>



Sponsored Links





Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive | Programming forum archive

Copyright 2008 droptable.com