Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Best Practice - Should the Connection Handle be stored
Message
From
22/11/2005 01:59:03
 
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Environment versions
Visual FoxPro:
VFP 6 SP5
Miscellaneous
Thread ID:
01070716
Message ID:
01071068
Views:
14
>
>Aah, this is interesting to me, I was getting the handle from the open remote view. I guess I will have to study SQLConnect and SQLDisconnect to get the connection the real way. My concern had come from the way I was obtaining the handle, from the View, so my concern was what when the DBC was closed and reopened would the handle be still valid, but your way I do not think that will ever be a problem, as the handle was obtained independently.
>
>Thanks a lot.

You are welcomed.

If you use remote views stored in the DBC, remember to set the SHARED property to .T. for all of them to use this method, otherwise they will still open a new connection each time.

DBSETPROP(cRemoteViewName, "VIEW", "ShareConnection", .T.)

Also use the correct version of SQLCONNECT so all your remote views can share the connection:

.ConnectionHandle = SQLConnect(cConnectionName, cUserID , cPassword, .T.)

Where cConnectionName is the name of the Connection used by the remote views.

And why would you close the Database in the middle of your application?

And I almost forget, of course do a (for example):

Open Database (goApp.DBCName)

before using SQLConnect

Carlos
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform