vfp9 and sql server express

Author: Rafael Copquin

Posted: 2009-04-30 at 20:02:55

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

©2009 Rafael Copquin