Insufficient key column for updating or refreshing Teen virgo web chat
To experiment and see what's going on, there are DBGrids and DBNavigators for each of these datasets.
In brief, the way the code below works is to temporarily filter the Ado Query master and the CDS masterdown to the current row and then force a refresh of their data and the dtail data for the current master row.
I told you that ADO has a bug which causes this, and that error occurs while deleting a record.
Googling finds numerous articles that say that it isn't possible at all with nested Client Data Sets without closing and re-opening the master CDS, which the OP doesn't want to do in this case. The short answer to the q is yes, in the reasonably simple case I've tested, and it's quite straightforward, if a bit long-winded; getting the necessary steps right took a while to figure out.
When I started looking into all this, it soon became apparent that with the usual master + detail set-up, although Providers + CDSs are happy to refresh the master data from the server, they simply will not refresh the detail records once they've been read from the server for the first time since the cds Master was opened. I don't think I need to post a DFM to go with the code.
I simply have Ado Queries set up in the usual master-detail way (with the detail query having the master's PK as a parameter), a Data Set Provider pointed at the master Ado Query, a master CDS pointed at the provider, and a detail c DS pointed at the Data Set Field of the cds Master.
Hello I need ur help for Deleting a number of rows in a dbgrid first my database is access and the error of deleting is "insufficient key conlumn information for updating or refreshin" and adoquery related with dbgrid is: SELECT tbl Messages.*, tbl Messages. Name FROM tbl Messages LEFT JOIN tbl Contacts ON tbl Messages. When you delete a record, DELETE statement has to find the record in the recordset.
I have only tested it with TAdo Queries feeding the CDSs' Provider.
I ran into a problem or two getting my "solution" working, the stickiest one being described in this SO question: Refreshing a Client Data Set nested in a Data Set Field I've verified that this works correctly with a Sql Server 2000(! Disable Controls; try try q Master Row Refresh(Master PK); except // Add exception handling here according to taste // I haven't encountered any during debugging/testing so: raise; end; finally q Master.
Doing it this way, unlike any other I tried, results in the detail rows nested in the cds Master's Data Set field getting refreshed. Enable Controls; end; end; procedure TForm1Master After Scroll(Data Set: TData Set); begin Refreshcds Master And Details; end; procedure TForm1Master After Post(Data Set: TData Set); // NOTE: The reason that this, in addition to cds Master After Scroll, calls Refreshcds Master And Details is // because Refreshcds Master And Details only refreshes the master + detail Ado Queries for the current // cds Master row.
Btw, the other blind alleys I tried included with and without po Fetch Details On Demand set to true, ditto cds Master. Evidently "Fetch Details On Demand" doesn't mean Re Fetch Details On Demand! Therefore in the case where the current cds Master row or its detail(s) // have been updated, this row needs the refresh treatment before we leave it. Apply Updates(-1); Refreshcds Master And Details; end; procedure TForm1Refresh Click(Sender: TObject); begin Refreshcds Master And Details; end; procedure TForm1Detail After Post(Data Set: TData Set); begin cds Master.
I guess you should also include primary keys of both joined tables in the SELECT statement too.
Obviously it does not have enough info about the record which is supposed to be deleted.