Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
CursorAdapters
Message
From
18/05/2005 23:13:27
 
 
To
18/05/2005 20:40:17
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
Environment versions
Visual FoxPro:
VFP 8 SP1
OS:
Windows XP SP2
Network:
Windows XP
Database:
MS SQL Server
Miscellaneous
Thread ID:
01015654
Message ID:
01015679
Views:
21
Michael,

Your local locursor reference to the cursoradapter goes out of scope and vaporizes when the program finishes. If a cursoradapter reference goes out of scope the cursor is automatically closed. Either use CursorDetach method to detach the cursor or keep the CA reference in scope.

>The cursor created with the code below, disappears when the wait window is clicked. The grid is populated as it should be, but as soon as the wait window is clicked the grid is cleared and the cursor disappears.
>
>As I am new to CursorAdapters, any help would be apprectaited.
>
>Sincere thanks in advance.
>
>Mike Mayo
>
>** code **
>thisform.grid1.recordsource='0'
>local locursor as cursoradapter, laerrors(1)
>set multilocks on
>locursor = createobject('CursorAdapter')
>locursor.alias = 'pdv'
>locursor.datasourcetype = 'ODBC'
>locursor.datasource = sqlstringconnect(remotedsn)
>locursor.selectcmd = 'select urn,podept,gst_tax_pc,addinfo,active from podept order by urn'
>locursor.keyfieldlist = 'urn'
>locursor.tables = 'podept'
>locursor.updatablefieldlist = 'urn, podept, gst_tax_pc, addinfo, active'
>locursor.updatenamelist = 'urn podept.urn, podept podept.podept, gst_tax_pc podept.gst_tax_pc, addinfo podept.addinfo, active podept.active'
>if locursor.cursorfill()
> thisform.grid1.recordsource='pdv'
> thisform.grid1.refresh()
> WAIT window
>else
> aerror(laerrors)
> =messagebox(laerrors[2])
>ENDIF
>** end code **
David Stevenson, MCSD, 2-time VFP MVP / St. Petersburg, FL USA / david@topstrategies.com
Previous
Reply
Map
View

Click here to load this message in the networking platform