Would someone demonstrate this? 
Author Message
 Would someone demonstrate this?

Would someone be so kind as to give a simple demonstration of how
to do the following:

Borland delphi for Windows: Database Application Developer's Guide
(p.120) says:

        "If an application needs to update the data in a read-only
         result set, it must use a seperate TQuery to construct an
         UPDATE statement.  By setting the parameters of the update
         query based on the data retrieved in the first query, the
         application can perform the desired operation."

To all those who have helped,
thanks in advance,

Marshall



Sun, 26 Jul 1998 03:00:00 GMT  
 Would someone demonstrate this?


Quote:
>Would someone be so kind as to give a simple demonstration of how
>to do the following:

>Borland Delphi for Windows: Database Application Developer's Guide
>(p.120) says:

>    "If an application needs to update the data in a read-only
>     result set, it must use a seperate TQuery to construct an
>     UPDATE statement.  By setting the parameters of the update
>     query based on the data retrieved in the first query, the
>     application can perform the desired operation."

The TQuery component has a DataSource property. This property can be used
to synchronize the record(s) returned or affected by the SQL for the TQuery
based on the current row in another TQuery component.

By way of example, assume a TQuery component Query1 (using DataSource1)
displays data from a table that is, for whatever reason, read-only. Another
TQuery, Query2 (using DataSource2), could be used to access the same record
current in Query1, but under circumstances not resulting in a read-only
state. Query2 is forced to display the same record as is current in Query1
by a number of factors acting in concert:

1. Its SQL is a SELECT query against the same table.
2. Its DataSource property is set to the TDataSource component for Query1,
   DataSource1.
3. Its SELECT query includes a WHERE clause based on the key field compared

   to a parameter of the same name as the key field.

For example, Query1 might be read-only due to linking multiple tables.
Here, the sample table CUSTOMER.DB is linked with the sample ORDERS.DB:

  SELECT C."CUSTNO", O."CUSTNO", O."ORDERNO"
  FROM "CUSTOMER.DB" C, "ORDERS.DB" O
  WHERE C."CUSTNO" = O."CUSTNO"

If the application then needed to be able to edit customer information for
the customer currently selected from the data set returned by the above SQL
query, Query2 would need to access only CUSTOMER.DB (so the data set will
be read-write) and be filtered to just the record for the current customer
in Query1:

  SELECT *
  FROM "CUSTOMER.DB" C
  WHERE C."CustNo" = :CustNo

Because CustNo is a field in Query1 (designated as the controlling data set
in the DataSource property of Query2), the parameter CustNo automatically
gets its value from the current record in Query1 from the field of the same
name, and the WHERE clause automatically uses that value to filter the data
returned by Query2 to a single record.

Use of the DataSource property of the TQuery is described on page 123 of
the Database Application Developer's Guide, in the section entitled "Using
the DataSource property."

**************************************************************************
Steve Koterski                    "Knowledge advances by steps, and not by
Product Group Manager             leaps."
Delphi Technical Support                       -- Lord Macaulay, 1800-1859
Borland International, Inc.



Mon, 27 Jul 1998 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Wanted: small, modular Pascal to demonstrate use of pointers

2. Hope someone can help

3. someone explain tags + this problem

4. Can someone please help?

5. PLEASE: could someone email me an algorithm using binary files....C description

6. Could someone veryify this -- memory leakage with TStoredProc (D3, Interbase)

7. can someone help, I need this asap?

8. QuickReport form writing (need to hire someone?)

9. looking for someone to make my program run faster

10. can someone explain dbase memo fields

11. source - datetime - promised someone this

12. Can someone please help?

 

 
Powered by phpBB® Forum Software