| Subject |
Re: modifying database path |
| From |
Mustansir Ghor <mustan31@hotmail.com> |
| Date |
Mon, 08 Nov 2021 05:38:30 -0500 |
| Newsgroups |
dbase.getting-started |
Dear Ken Sir
Thank you Akshat, Thank you Ken sir
Yes both solutions are useful.
There is one issue, will the _app.session.addalias() method override any bde alias that are defined in the ini with same name
Best Regards
Mustansir
Ken Mayer Wrote:
> 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
|
|