Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Best Practice - Should the Connection Handle be stored
Message
 
To
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:
01071074
Views:
24
Hi Carlos

>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.)

I have just done it. But as soon as I have made all of them share the connection I start getting the following error and I am not able to access any of the forms:
Error #:    52
Message:    No table is open in the current work area.
Line #:     30
Code:       lnBufferMode = CURSORGETPROP("Buffering", This.cAlias)
Method:     init
Object:     abo_maccounts

Error #:    52
Message:    No table is open in the current work area.
Line #:     32
Code:       IF CURSORGETPROP("SourceType") = DB_SRCTABLE
Method:     init
Object:     abo_maccounts

Error #:    107
Message:    Operator/operand type mismatch.
Line #:     40
Code:       This.oBehavior.lCheckForUpdateConflicts = (lnWhereType = DB_KEY) AND INLIST(lnBufferMode, DB_BUFOPTRECORD, DB_BUFOPTTABLE)
Method:     init
Object:     abo_maccounts
I reset the views back to Not Shared and the app starts working normally. I use CodeBook 6.2 as the framework. But nevertheless I have successfully got the connection handle atleast for SQL Pass-thru's from the connection name that I have stored in the DBC.


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

I have used the following code to open and close handle, plus I guess VFP6 does not have the .T. parameter:
... in the startup of the app object
THIS.nConnHandle = SQLConnect("VSO3Data_FB")
... in the cleanup of the app object
SQLDISCONNECT(THIS.nConnHandle)
>And why would you close the Database in the middle of your application?

Not that I am doing it, just in case if the farmework is doing it so.


>Open Database (goApp.DBCName)
>
>before using SQLConnect

Yes, thanks.
Regards
Bhavbhuti
___________________________________________
Softwares for Indian Businesses at:
http://venussoftop.tripod.com
___________________________________________
venussoftop@gmail.com
___________________________________________
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform