Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Syed Imran Ulhaq
  Where is Syed Imran Ulhaq?
 Saudi Arabia
 Syed Imran Ulhaq
 To: Ken Murphy
  Where is Ken Murphy?
 Ken Murphy
Subject: RE: Multiple Databases in forms
Thread ID: 155283 Message ID: 155293 # Views: 1 # Ratings: 0
Version: Visual FoxPro 9 Category: Databases, Tables and SQL Server
Date: Saturday, December 29, 2007 7:49:15 AM         

> > Dear Members
> > hi
> >
> > I have designed 2 different applications. Both have different screens and databases.
> > Now I am trying to merge them into one form and trying to run applications thru menus.
> > Can I use application in one directory and databases in two sub-folders.
> > At design time, i have placed table in DE and placed same dbc on network for online version of application.
> > I tried to use set database to but form searches table in Design time dbc.
> > how i can use two different databases in single application.
> > thanks for help.
> > regards,
> >
> > Imran Syed
> Imran,
> I often use multiple databases.
> IF NOT DBUSED([MyDatabase1])
>    OPEN DATABASE [Path2\MyDatabase1.dbc]
> IF NOT DBUSED([MyDatabase2])
>    OPEN DATABASE [Path2\MyDatabase2.dbc]

> The key to using more than one database is addressing the tables. For example, if you have a table in each database called "MyTable" you need to be able to tell VFP which table to work with. Use the database name as follows:
> USE MyDatabase1!MyTable IN 0 SHARED ALIAS MyTable1 && note the "!" between the database name and the table name
> USE MyDatabase2!MyTable IN 0 SHARED ALIAS MyTable2

> If you are dragging tables onto a D/E, then just drag the table from the correct DBC and then go into the properties tab and set the alias to what ever you want. Once you have a unique alias, that is pretty much all you need. For example:
> REPLACE MyTable1.cMyField WITH lcSomeValue IN MyTable1

> will change the cMyField field value in the MyTable.dbf in MyDatabase1.dbc
> Ken
> You shall know the truth - and the truth shall set you free. (John 8:33)

Thanks alot sir for reply.
When I develop application, i used dbc installed on my laptop's C drive, in actual i implement app on network (copying app and dbc on a shared folder in server).
What I did created three folders on server (app, dbc1,dbc2) app has main application menu having two different application options billing (for dbc1) and accounts(dbc2). When i try to open form in accounts, instead of going in dbc2 folder, control asks for table placed in development environment.
I think i highlighted my problem more clearly and you will guide me in right direction.

THanks for your reply.




Multiple Databases in forms Posted by Syed Imran Ulhaq @ 12/28/2007 11:33:16 PM
RE: Multiple Databases in forms Posted by tushar @ 12/29/2007 6:15:17 AM
RE: Multiple Databases in forms Posted by Ken Murphy @ 12/29/2007 6:28:33 AM
RE: Multiple Databases in forms Posted by Syed Imran Ulhaq @ 12/29/2007 7:49:15 AM
RE: Multiple Databases in forms Posted by Ken Murphy @ 12/29/2007 1:33:20 PM