Database Strategy
Pete
pete at mollysrevenge.com
Wed Nov 16 13:04:51 EST 2011
Sounds like the problem is that you close the cursor when the card is
closed. From that point, it's not a valid cursor, as you're finding when
you return to the card. When you return to the card, you'd need to either
leave the cursor open or re-execute the SELECT statement that created it.
Depending on the needs of your application, you might want to consider
not creating a cursor but returning the data from the SELECT statement
directly to your application using revDataFromQuery and storing that in a
custom property. That's useful if you are using a datagrid on your card
since you can simply set the dgtext of the datagrid to the returned data to
populate the datagrid.
Pete
Molly's Revenge <http://www.mollysrevenge.com>
On Wed, Nov 16, 2011 at 9:03 AM, <mike at doub.com> wrote:
> I am new to the world of databases and I need some advise.
>
> I am currently opening and closing the database in the open and close
> stack handlers. I am storing the connection I'd in a custom stack property.
>
> When I go to a card, I am creating a cursor, directly loading each record
> into the datagrid. Upon closing the card I close the cursor.
>
> Now this works fine when I load rev for the first time and go to the card
> with the datagrid. When I leave the card and return, I am getting errors
> indicating I have invalid cursor ID.
>
> So should I be opening and closing the entire database in the card?
> I am not seeing anything wrong examining the close cursor function.
>
> As a separate question can you have multiple cursors open at the same
> time. I would think so.
>
> Thanks in advance.
>
> -= Mike
>
>
> Sent from my BlackBerry device on the Rogers Wireless Network
>
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>
>
More information about the use-livecode
mailing list