>I've noticed when using Access, if I need to "kill" a running query all I need to do is press the + keys and the query stops almost instantly. However, when I need to kill a VFP remote connection view/query, it sometimes takes forever for VFP to release the query. I have ESC set ON so that's not the problem. In both examples, Accesss vs. VFP, both are connected to the same MS SQL back-end. It appears that Access is much more efficient in communicating with SQL to release the connection than VFP. Am I missing something? Has anyone written a PRG or utility that caused a remote view connection to "die" instantly when requested? > >Thanks, >Robert Wright Hello Robert
If the query time is big, I use asynchronous coonection type sqlsetprop(conhandle,'Asynchronous',.t.) In this mode we wait for result in the loop m.res=sqlexec(conhandle,m.sql,'cursor')
do while m.res=0 *put here testing keyboard on some symbol ** for example using charsaw function ** if you see it, make sqlcancel m.res=sqlexec(conhandle,m.sql,'cursor') enddo sqlsetprop(conhandle,'Asynchronous',.f.) ** I also use setting fetchasneeded and fetsize properties of the cursor to make 'step' query There is also other way to make 'step' queries of the big tables To use server hints Let we have table with som index can be used for ordering we make query like this select top 100 * from table (with(someindex)) order by name someindex is built on field name This query will run fast We go bottom in the cursor on the client and keep in some variable last value on field name Let it will be m.name=cursor.name Next query we send to server will be like this select top 100 * from table (with(someindex)) order by name where name >?m.name So we can put making these queries in circle on VFP client and can stop at any step, if we need it At the time we stop we have few cursors at client
Best wishes, Vladimir
MVP-2006-2011, PHD in Math and Physics , host of www.foxclub.ru, VFP lector at Interface and Microinform companies Head science researcher of VNIIA Rosatom.