newbie - making join queries writable 
Author Message
 newbie - making join queries writable

As I understand it, not all sql queries can be made writable.  If I
have a TDBGrid that displays the results of this query:

select table1.field1, table2.field2 from table1, table2, where
table1.field3=table2.field3

Then the user cannot make changes to the values in those fields.

Am I understanding that correctly?  If so, is there an accepted
workaround?  All I could think of was to have multiple TQuery objects
on the form with multiple DBEdit fields and keep changing the sql
statements to duplicate a join statement.

Any better ways?

This is with delphi 5 and odbc access to a mysql database server.

Thanks,



Mon, 12 Dec 2005 03:23:43 GMT  
 newbie - making join queries writable

Quote:

> As I understand it, not all sql queries can be made writable.  If I
> have a TDBGrid that displays the results of this query:

> select table1.field1, table2.field2 from table1, table2, where
> table1.field3=table2.field3

> Then the user cannot make changes to the values in those fields.

> Am I understanding that correctly?  If so, is there an accepted
> workaround?  All I could think of was to have multiple TQuery objects
> on the form with multiple DBEdit fields and keep changing the sql
> statements to duplicate a join statement.

This type of query is not updatable.  You can't open a "live query view" on
it.  

What you can do, however, and what I'd recommend anyway that you do, is to
run the query, put the results into a local table of some kind {or just
store 'em in memory}, update them there, and then .. if the user presses
"OK" .. execute separate queries to update the actual data.

----------------------------------
Fast automatic table repair at a click of a mouse!
http://www.sundialservices.com/products/chimneysweep



Mon, 12 Dec 2005 04:59:16 GMT  
 newbie - making join queries writable

Quote:
>As I understand it, not all sql queries can be made writable.  If I
>have a TDBGrid that displays the results of this query:

>select table1.field1, table2.field2 from table1, table2, where
>table1.field3=table2.field3

>Then the user cannot make changes to the values in those fields.

>Am I understanding that correctly?  If so, is there an accepted
>workaround?  All I could think of was to have multiple TQuery objects
>on the form with multiple DBEdit fields and keep changing the sql
>statements to duplicate a join statement.

>Any better ways?

>This is with Delphi 5 and odbc access to a mysql database server.

>Thanks,

The only way they are are updateable is by using cached updates.  Look
up TUpdateSQL and CachedUpdates


Wed, 21 Dec 2005 17:43:54 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Join Query Record in the same Query...

2. Performing join with query

3. joining a paradox table to an MSAccess table in an SQL query

4. Making Query for DBF file from Dos Prompt

5. Visual Query Builder and Outer Joins

6. Joined Query does not work

7. SQL problem - joins plus sub query (Paradox7)

8. Interbase / joins/query, etc.

9. SQL Queries and Outer Joins

10. joins in read-only queries (Paradox)

11. Making Query for DBF file from Dos Prompt

12. Query Builder and outer joins.

 

 
Powered by phpBB® Forum Software