Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Change database in a connection programmatically ?
Message
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Client/serveur
Divers
Thread ID:
00518231
Message ID:
00535570
Vues:
15
Hi!

Just read all messages in this thread accurately.

* Switch to another database
SQLEXEC(CURSORGETPROP('ConnectHandle','MyView'),'USE Databasename')
Requery('MyView')

Take a look to the following options for view in the help file for DBGETPROP() and DBSETPROP() functions: FetchAsNeeded, FetchMemo, FetchSize

Set FetchAsNeeded to .F. for each view. When it is .T., the query for view runs in quite interesting manner - VFP get first (FetchSize) records from the SQL Server and continue execution of other commands. In such state, when all other records are not returned, you cannot run other SQL commands because query for view is not finished. As soon as you try to access (FetchSize+1) record in view alias, next chunk of data is get from SQL Server and so on until all data returned. When all views are not shared, this will work very well. With SHARED option another view requery will fail until first view query return all data. When you want to switch database for all views, you will require to sitch off FetchAsNeeded option for all views. When you want SHARED views, you require to do the same.

HTH.

>Hi Vlad,
>
>Thanks for taking time out to respond. Let me take a moment to describe my situation.
>
>I am in charge of redesigning a LARGE VFP 6 application to move from FoxPro database backend to a SQL Server 2000 backend. I have been able to make the following changes across my application.
>
>1. All forms are Remote View based. (I use SPT for non-visual work)
>2. All Views are set to NODATA on Load.
>3. All Views are parameter driven as to reduce the amount of data to only the necessary records.
>
>I can set all the Remote Views to Share Connection. I haven't done so yet for 2 reasons.
> 1. The system was working when I didn't share the connection. (I had tried sharing one before but the Connection is busy error popped up everywhere.)
> 2. I wasn't sure if every connection correlated to a SQL Server seat, which correlates to money! This is BAD! :)
>
>What I would like to see explained:
>
>If I open all the views in my form with NODATA on load, and make sure that they are all have Share Connection set to True, what else would I need to do to make sure I do not see the Connection is busy error?
>
>Also you mentioned sending the "use" command to SQL Server to swap databases to get around the build in connection of the remote view. Could you sample this as well?
>
>TIA
>
>-- Chris
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
Répondre
Fil
Voir

Click here to load this message in the networking platform