Solved

Delphi Programming question

Posted on 1997-09-11
6
183 Views
Last Modified: 2010-04-04
I've got a DBGrid in which several titles are listed with their media (CD,LP,MC). I've made the Datasource of the grid a Query,because the titles are linked to a media DBFile using a Media_ID field. (I wanted the  name of the medium appear in the GRID rather than the ID,so I thought I had to use a Query here). But updating a record is now causing a problem,because the Query is readonly. Is there a standard solution for this sort of problem?
0
Comment
Question by:lizzzard
6 Comments
 
LVL 1

Expert Comment

by:CFantin
ID: 1344687
Can you give a bit more detail.

I understand this as you having 2 tables that are linked together
in the query. You need to display fields from both querys. When you update the dbgrid you want to update the appropriate tables.

0
 
LVL 5

Expert Comment

by:ronit051397
ID: 1344688
try to set the property 'RequestLive' to true
0
 
LVL 1

Expert Comment

by:CFantin
ID: 1344689
The reason you cannot set the Query RequestLive to true is because you are selecting from multiple tables.

You can look at the cached updates and the UpdateSQL component.
I do not have time to sort out example code but if you look at those you may be able to figure out how to do it.
0
Active Directory Webinar

We all know we need to protect and secure our privileges, but where to start? Join Experts Exchange and ManageEngine on Tuesday, April 11, 2017 10:00 AM PDT to learn how to track and secure privileged users in Active Directory.

 

Author Comment

by:lizzzard
ID: 1344690
Ronit:I already did that,but it don't work. Thanks for the suggestion though.
CFantin:OK,the situation is as follows:
      
      File1:Sources           File2:Media
      Source_ID                     
      Source_Medium    --->      Medium_ID      
      Source_Title             Medium_Name
      enz..

In the DBGrid I want listed: Source_ID Source_Title Medium_Name
Now I want the user to be able to update the record in the DBGrid,if it is possible using a DBListbox for looking up the Source.
Thanks for your help
0
 
LVL 1

Expert Comment

by:CFantin
ID: 1344691
Sorry but I cannot help!
No time.


0
 

Accepted Solution

by:
kwang080897 earned 50 total points
ID: 1344692
Use a Ttable as database source. In the field editor add a new field and make it a lookupfield. point it to the secondary table like this:

Dataset=Media
Keyfield=Source_medum
Lookupfield=Medium_id
Resultfield=Medium.name

Remember to setup a Fieldname,Fieldtype+size for the new field.

This will also give you a dropdown list when you click
(or dubbleclick) in the dbgrid

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

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
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…

820 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