Board index » delphi » Can't Move to Next Record

Can't Move to Next Record

 I am able to update my database with the ExecSQL

Now, because I have a multi-table query. Request Live is False, and I am
not using Cached updates. The EXecSQL works fine for updating.

The problem is, because of a read-only result set I can't navigate to
the next record to send the next e-mail. ( One E-mail is sent and then
the entire database is updated, stating that all e-mails have been
'MAILED' where they use to say 'AVAL'. But only one record has actually
been sent.

Query.next; (to move to the next record) is when the "cannot perform
this operation on a closed dataset" error appears.
I know why I'm getting this error, I'm wondering if anyone has any info
on how to navigate to the next record in a read-only dataset. This
program starts up, send the e-mails and shuts down, there are no
dbGrids, fields, or any displayed data for that fact. It runs like a
batch file and then closes.

Got any Ideas?
Kenneth

 

Re:Can't Move to Next Record


Kenneth,

  You have a read-only query that you do not use RequestLive/CachedUpdates,
and issue ExecSQL to perform some updates.  Are you using the same TQuery
for all this?  If so, then that's the problem.  Once you clear/close the
query, add whatever SQL, you lose the data (and you get the error).

Use CachedUpdates or TClientDataSets and save yourself the headaches

Good luck,
krf

http://community.borland.com/article/0,1410,22571,00.html

Quote
Kenneth Peckham wrote in message <39AC07F1.2B8CF...@envirotest.com>...
> I am able to update my database with the ExecSQL

>Now, because I have a multi-table query. Request Live is False, and I am
>not using Cached updates. The EXecSQL works fine for updating.

>The problem is, because of a read-only result set I can't navigate to
>the next record to send the next e-mail. ( One E-mail is sent and then
>the entire database is updated, stating that all e-mails have been
>'MAILED' where they use to say 'AVAL'. But only one record has actually
>been sent.

>Query.next; (to move to the next record) is when the "cannot perform
>this operation on a closed dataset" error appears.
>I know why I'm getting this error, I'm wondering if anyone has any info
>on how to navigate to the next record in a read-only dataset. This
>program starts up, send the e-mails and shuts down, there are no
>dbGrids, fields, or any displayed data for that fact. It runs like a
>batch file and then closes.

>Got any Ideas?
>Kenneth

Re:Can't Move to Next Record


Quote
Kenneth Peckham wrote in message <39AC07F1.2B8CF...@envirotest.com>...
> I am able to update my database with the ExecSQL

>Now, because I have a multi-table query. Request Live is False, and I am
>not using Cached updates. The EXecSQL works fine for updating.

You cannot use the *same* TQuery to open a Select statement and calling
ExecSQL on an Update statement. Use a second TQuery for the update statement
and call ExecSQL on that, that way you can leave the first query with the
read-only Select open and you will be able to continue browsing the records.

--
Wayne Niddery (WinWright Inc.)
RADBooks - http://members.home.net/wniddery/
Helicopters can't fly; they're just so ugly the earth repels them.

Other Threads