?
Solved

Queries and Cached Updates

Posted on 1997-12-11
4
Medium Priority
?
143 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 400 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

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…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
Suggested Courses

771 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