| Subject |
Re: modifying database path |
| From |
Ken Mayer <dbase@nospam.goldenstag.net> |
| Date |
Sun, 7 Nov 2021 10:56:17 -0800 |
| Newsgroups |
dbase.getting-started |
On 11/7/2021 12:54 AM, Mustansir Ghor wrote:
> Dear All
>
> I have a setup where an application runs for multiple companies. I have company.dbf that store company name and its database path folder. But how can than we assign database name to the selected path for the company selected.
>
Following up a bit on Akshat's example:
Probably in a startup routine:
Open company.dbf table. Find the Company name, and get the database path
folder from the table.
Assume you put it in a variable such as:
cCompanyPath = value_from_table (however you are doing this, whether it
is being done ... XDML, OODML, etc.).
Then you can create a User BDE Alias this way. There's not really a need
to create a new session object, but Akshat shows that. I suggest you can
also just do this:
// This requires the three parameters, the first is the name of
// the database alias, you should, in your code, be using the
// same alias name throughout, so that you don't have to
// change the code.
// The second is the database type, in this case "DBASE".
// The third is the word (with the colon) "Path:" followed by
// the actual path, from your company table
_app.session.addalias("CompanyDatabase","DBASE","Path:"+cCompanyPath )
This will be available as a User BDE Alias until you close dBASE. From
there you can create database objects:
dMyDatabase = new database()
dMyDatabase.databaseName := "CompanyDatabase"
dMyDatabase.active := true
and so on.
Hope that helps a bit.
Ken
--
*Ken Mayer*
Ken's dBASE Page: http://www.goldenstag.net/dbase
The dUFLP: http://www.goldenstag.net/dbase/index.htm#duflp
dBASE Books: http://www.goldenstag.net/dbase/Books/dBASEBooks.htm
dBASE Tutorial: http://www.goldenstag.net/dbase/Tutorial/00_Preface.htm
dBASE Web Tutorial: http://www.goldenstag.net/dbase/WebTutorial/00_Menu.htm
|
|