Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Change database in a connection programmatically ?
Message
 
 
À
12/06/2001 04:07:21
Information générale
Forum:
Visual FoxPro
Catégorie:
Client/serveur
Divers
Thread ID:
00518231
Message ID:
00518233
Vues:
20
Hi!

You can only create the connection on the fly in the database available for exclusive use. Usually it is a separate startup program that creates the database locally, get user name and password (or even other properties), then create the connection in database, then create all views based on that connection.

If you just want to change the database name on the SQl Server, you can just send a command to SQL Server using SQLExec:

SQLExec(nConnectHandle,"USE MyDatabase")

This command will change current database for SQl Server connection session. You can get the nConnectHandle value from the CursorGetProp('ConnectHandle') function for some opened remote view. However, the view should be based on the query with direct specifying of the database.table, however, I guess it is much better to make a view using "SELECT 123 as somefiled"; you can create it using CREATE SQL VIEW command only. Having connect handle from such database-independent view, you can change the current database, then use all other views.

HTH.

>Dear All,
>
>I have a program that connected to SQL Server and i made a database for each company in SQL Server.
>
>I made a connection to SQL Server for a database using database designer.
>Is that any other way to change programatically the database that i will use which i have defined before in database designer, beside SQLStringConnect?
>I can't also use DBSetProp to change the database because in 1 PC, we can run the same program for 2 companies at a time.
>
>Thanks,
>
>Andy
Vlad Grynchyshyn, Project Manager, MCP
vgryn@yahoo.com
ICQ #10709245
The professional level of programmer could be determined by level of stupidity of his/her bugs

It is not appropriate to say that question is "foolish". There could be only foolish answers. Everybody passed period of time when knows nothing about something.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform