Board index » delphi » ADO and Lookup-Refresh problem!

ADO and Lookup-Refresh problem!

Hallo

Environment:
- Delphi 6 Enterprise
- MSSQL-Server 2000
- ADO is used for access MSSQL

A database table contains a self join. In Delphi I use two ADODataset
components, one as a "normal dataset" and the other as the lookup-dataset
for the self join (persistent lookup-field in the first ADODataset). A
DBLookupComoBox is connected with the persistent lookup-field. All works
fine, with one exception: When I add new records to the dataset, these
records where physically stored on the Server, but they aren't displayed in
the lookup-dataset. After I close the lookup-dataset and open it again, I
see all records. The newer ones are only seen after I make a reopen in code.

Using ADOTable instead of ADODataset causes the same problems.

When I use BDE-based components really all works great. I don't have to
write any code for refreshing the lookup-dataset. When records were added,
they were (after storing) automatically shown in the DBLookupComboBox.

Any ideas for this strange behaviour. How can I realize auto-refreshing
lookup-datasets in ADO?

Regards
Stephan

 

Re:ADO and Lookup-Refresh problem!


Quote
>When I use BDE-based components really all works great. I don't have to
>write any code for refreshing the lookup-dataset. When records were added,

Try this code
var
  stKeyfld:string;
begin
stkeyFld:= cbo.keyField;
cbo.keyField:= '';
cbo.keyfield := stkeyFld';

--
Brian Bushay (TeamB)
Bbus...@NMPLS.com

Re:ADO and Lookup-Refresh problem!


Thanks for your response.

Quote
> Try this code
> var
>   stKeyfld:string;
> begin
> stkeyFld:= cbo.keyField;
> cbo.keyField:= '';
> cbo.keyfield := stkeyFld';

Where should this code be placed?

Stephan

Re:ADO and Lookup-Refresh problem!


Quote
>Where should this code be placed?

Try the listSource.dataset AfterPost method.
--
Brian Bushay (TeamB)
Bbus...@NMPLS.com

Other Threads