| Subject |
Re: modifying database path |
| From |
Akshat Kapoor <akshat.kapoor@kapoorsons.in> |
| Date |
Sun, 7 Nov 2021 17:41:47 +0530 |
| Newsgroups |
dbase.getting-started |
Good Evening Mustansir,
>
> 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.
>
> Can Anybody help me on this
Instead of using BDE alias use temporary database alias
Sample code
this.unc = alltrim(company->unc)
//Retrieve path from the table.
this.session = new session()
//new session
this.session.addalias("muneem","DBASE","Path:"+this.unc+this.direct)
//Create a database alias
this.db = new database()
this.db.session = this.session
this.db.databasename = "muneem"
this.db.active = true
'this' in the above code is a custom object mcompany.
Then in dmd
this.trans = new QUERY(this)
with (this.trans)
database = mcompany.db
//use the alias declared above.
sql = .................
This is the code I am using.
The database alias is temporary and can be reset any number of times.
Regards
Akshat
|
|