Solved

Queries and Cached Updates

Posted on 1997-12-11
4
141 Views
Last Modified: 2010-04-04
I run a query to select rows from a table (just one!)
based on user input. I then need to print the data from the selected rows.
The order is important, so I use an Order By clause which prevents me from
setting the RequestLive property to true. Finally, after each row is
printed, I mark the row as printed along with the date. This is important so
that if there is a printer error or other problem, the user would only need
to reprint from where they left off. The code is as follows:

1.    query the table
Select * from customertable where customernumber = :customernumb
2.    process the result
try
   Query1.Open;
   While not Query1.eof do
      begin
           PrintRoutine(Query1);
           Query1.Edit;
           Query1.FieldByName('DATEBILLED').Value := Date;
           Query1.FieldByName('ACTCODE').Value := 3;     (***marks the row
as printed**)
           Query1.Post;
           Query1.Next
      end;
except
   showerror
end;
3. update the rows as printed
MyDatabase.ApplyUpdates([Query1]);

At the MyDatabase.ApplyUpdates([Query1]) line I get an application error
with the message table is read only. I thought that is why you use a
TUpdateSQL component! I don't know if this helps you understand my problem
better or not. I have been struggling with this for awhile and would
appreciate any help. I am using Delphi 2.01 with a Paradox table.

Jay Eisenstock

0
Comment
Question by:jeisen
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 1

Expert Comment

by:zac
ID: 1353414
What is the contents of your UpdateSQL objects' modify property, and what are the key fields in the database?
0
 

Author Comment

by:jeisen
ID: 1353415
In response to the question about the UpdateSQL Property:
update CustomerTable
  ACTCODE = :ACTCODE,
  DATEBILLED = :DATEBILLED
where
  CUSTOMER = :OLD_CUSTOMER

I used the update SQL editor to generate the code. The key fields are CUSTOMER and CODENUMBER.
0
 
LVL 2

Accepted Solution

by:
mvz121697 earned 200 total points
ID: 1353416
Cached update's is not supported for local table's like Paradox.
I think you should use a second query, whith an update statement for the customertable.
You can build this dynamicly with the values you read form your query1. In the where clause you use the primary key from query1. After this you have to reopen Query1 to see the results in this query.

Hope this helps.
0
 

Author Comment

by:jeisen
ID: 1353417
I graded the answer C because I found a better solution. Here it is:
1  Change the original query to eliminate the "order by" clause and set "RequestLive" to true
2  Batch copy the query to a temporary table indexed by the values in the original "order by" clause
3  Process through the indexed table sequentially to print each value. Then, do a Locate on the query to update the values
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Delphi Form ownership 4 153
how to update exe applicatio from internet ? 6 105
DBCtrlGrid, Delphi, Scroll 8 82
QuickReport, Delphi, Shape 12 44
Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

739 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question