Solved

Deleting from a query

Posted on 1998-07-15
6
138 Views
Last Modified: 2010-04-04
In porting a d1 project to d3 I have found problems with code that deletes from a query. No I get a table is read only message. The query does not return a live result set even if requestlive is set to True as Order By is used. Anyway, I don't want a live result set I simply want to be ablt to delete some records from the query that I couldn't do with SQL. How can I set the query up so this is possible? Thanks, Tom.
0
Comment
Question by:tomcorcoran
[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
6 Comments
 
LVL 3

Expert Comment

by:KE
ID: 1357947
First of all, if you wan't to operate on the query data directly you will have to get a live set from the query.

You can also choose to update your table in a TTable, and get a unique identifier from your query for the TTable.

Lets say, you construct a huge query which would never be able to return a live set, no matter what you do. If your query at the same time request some unique row ID's, you can use these ID's in a TTable to delete/modify these rows.

Supply the query statement if you can't live without a live result set ;-) I'll see then if I can point out any non live-set aspects in it.
0
 
LVL 4

Expert Comment

by:jeurk
ID: 1357948
You could use a TUpdateSql to achieve what you want.
Look at it's help its explained right easily.
I've never used it but I know it should be done with that.
I hope it helps.
Jeurk
0
 

Author Comment

by:tomcorcoran
ID: 1357949
Hi,

I do not use a TUpDateSql as like I said I do not wish to update the TTable. KE, I did not understand what you were saying. I need to work with the modified query but not write the changes to the database.

Thanks, Tom.
0
Independent Software Vendors: 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!

 

Expert Comment

by:nileq
ID: 1357950
Hi,
Pleas supply the SQL Statment.
(By the way you don't use Query.Open, do you?)
0
 
LVL 3

Accepted Solution

by:
vladika earned 50 total points
ID: 1357951
Set Query1.CachedUpdates = True and
write such OnUpdateRecord handler

procedure TForm1.Query1UpdateRecord(DataSet: TDataSet;
  UpdateKind: TUpdateKind; var UpdateAction: TUpdateAction);
begin
  UpdateAction := uaApplied;
end;

Now you can modify your dataset as you want and
changes will not writes to the database.

0
 

Author Comment

by:tomcorcoran
ID: 1357952
Vladika, I knew there had to be a way, thanks a million, that works perfectly.
Tom.
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

688 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