Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Cannot Access The Table
Message
From
03/10/2001 10:21:46
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
03/10/2001 08:11:35
Agnes Cheng
DynamicTech Consultants Ltd.
Hong Kong, Hong Kong
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00563504
Message ID:
00563587
Views:
18
>I got two same database name which located in two directories:-
> pAirAcctDataBase = pub_airacctdatapath + 'account.dbc'
> pSeaAcctDataBase = pub_seaacctdatapath + 'account.dbc'
>
> pAirPrg = pub_airacctprgpath + 'caloverdueamt_air'
> pSeaPrg = pub_seaacctprgpath + 'caloverdueamt_sea'
>
>Now, IN the form's cal_overcreditlimt method , there are some codes as follow:-
> OPEN DATABASE &pSeaAcctDataBase
> SET PATH TO &pub_seaacctdatapath
> set database TO &pSeaAcctDataBase
> SET PROCEDURE TO &pSeaPrg additive
> pSeaDueAmt = CALOVERDUEAMt_sea(pCompanyCode,pDate)
> CLOSE DATABASEs
>
> OPEN DATABASE &pAirAcctDataBase
> SET PATH TO &pub_airacctdatapath
> set database TO &pAirAcctDataBase
> SET PROCEDURE TO &pAirPrg additive
> pAirDueAmt = CALOVERDUEAMt_air(pCompanyCode,pDate)
> CLOSE DATABASEs
>
> SELECT "InvoiceHeader" <-- Error
>
>I can get the different value of pSeaDueAmt and pAirDuemAmt
>However, as i 'close databases' it said 'Cannot access the selected Table'.
>If i remove the 'CLOSE DATABASES' , i can get the SAME value of pSeaDueAmt and pAirDueAmt , but without the 'Error'.
>
>I understand that As I 'Closes Database' ,it will close my current databases.
>however, if i didn't close database,.. it seems the program cal the data from the same databases anme , it seems ignore my'set path'
>
>Pls Help.
>From Agnes

Agnes,
Code is hard to follow :(
1) Do not use & but name expression for names (). ie :
OPEN DATABASE (pAirAcctDataBase)

2) CALOVERDUEAMt_air() hides the offending code. Probably you do SQL there. If so when you close databases you also close it.

3) Instead of opening-closing databases IMHO supply the path of tables directly and possibly aliases in order to avoid same table name thus auto aliasing problems.

Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Reply
Map
View

Click here to load this message in the networking platform