Clearing a cursor

I am working with a cursor that I use to import XML information to.

When I am done with the XML information, I want to clear the cursor for other input from the same area; however, I am unsure as how to go about this.

Any ideas




Answer this question

Clearing a cursor

  • Claudio Aguilar

    Andy,

    Thanks for the extension.



  • mgraul

    Hi Dave

    Ahem....if I may be permitted to extend your note....

    CREATE CURSOR ( ... ) cursors and those created by SQL PassThrough (SQLEXEC()) are read/write by default. Cursors created by a SQL-SELECT against native VFP tables are not.



  • Laure

    Like Cetin said, if it's R/W you can always ZAP as if it were a table.

    The question is, if you generate the cursor by importing data, once you are done, why not regenerate and get a new cursor What's the point of clearing it If what you want is to save an empty structure from what you imported, after done with the data you can always do a COPY STRUCTURE ...


  • burning snow

    Are cursors R/W by default


  • rehpix

    If it's not readwrite first make readwrite then:

    zap

    Is there a reason you're not simply calling your "import" routine again (in other words couldn't clearly understand what you're doing)


  • CCODER32

    I do call my import routine again (it is through a button).

    Essentially what happens is I get information from a ListBox and put it into a cursor. When I add the information to my SQL database, I want to empty the cursor. This way I can put in new information from that ListBox.

    Hope that better explains it.


  • crazyTheo

    By default No.

    When creating a cursor (depending on your VFP version) you can use the READWRITE modifier.

    Else you can always make a cursor RW by reopening as a table.

    See:

    http://fox.wikis.com/wc.dll Wiki~EditableCursors


  • superbrad

    >Are cursors R/W by default

    CREATE CURSOR ( ... ) cursors are read/write by default. Cursors created by a SQL-SELECT are not.



  • Luiz Fabio

    Cursors are not readwrite by default if:

    -It's a result of "select-sql"

    -'readwrite' clause is not included

    However I doubt you need a readwrite cursor or need to empty it for "new information". ie:

    select * from customer where country = "USA" into cursor xx nofilter

    * do something with that

    select * from customer where country = "UK" into cursor xx nofilter

    as you see no need to 'empty' the cursor to fill in with 'new information'. A new select does that for you.


  • Clearing a cursor