Issue the following line somewhere in the beginning of your program
(before connecting to SQL Server):

SQLSetProp(0,"Shared",.T.)

This will force VFP to force first connection that will be made to be shared.

On Fri, May 1, 2009 at 3:02 AM, Rafael Copquin <[email protected]> wrote:
> I am rapidly updating my knowledge of VFP to start using SQL Server as a
> back end (a long overdue issue in my programmer life)
>
> I am using among other sources the book:
>
> Client-Server Applications with Visual FoxPro 6.0 and SQL Server 7.0 by
> Chuck Urwiler and others.
>
> In reference to transactions, the authors recommend to use shared
> connections.
>
> I am building a one to many form, basically an invoice header and its
> corresponding details. Both cursors can be generated using views and a
> connection can be shared with the following command:
>
> create sql view v_customers ;
> connection myconn share as..........
>
> My question is:
>
> How can I share a connection if instead of views I use cursor adapters? I
> tried this approach:
>
> start the first CA
> once the cursor is obtained, get its connection handle with cursorgetprop
> try using this handle in the datasource property of the second CA
>
> thisform.oCA.DataSource   =
> sqlstringconnect([dsn=test;trusted_connection=yes])   && for the first CA
> nHandle = cursorgetprop('connecthandle', thisform.oCA.Alias)
> thisform.oCA1.DataSource = sqlstringconnect(nHandle)     && in the second CA
>
> but somehow, it did not work
>
> BTW, CAs can be used in the above scenario, almost the same as with DBF's.
> One can issue the requery command after a tableupdate (with buffering set to
> 5), and they work very well. However, I can't get them to share a
> connection.
>
> TIA
>
> Rafael Copquin
>
>
>
[excessive quoting removed by server]

_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/profox
OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: 
http://leafe.com/archives/byMID/profox/[email protected]
** All postings, unless explicitly stated otherwise, are the opinions of the 
author, and do not constitute legal or medical advice. This statement is added 
to the messages for those lawyers who are too stupid to see the obvious.

Reply via email to