0

I am converting a large Delphi 2007 program from Paradox to SQL Server but the Ttable.Setrange function is not available in ADO. I've tried the ADO Filter property but I can't get the results I want.

This is the code I want to change to use an ADO Filter

    SopHeads.SetRange([OrderNumber,0],[OrderNumber,0]);
    SopLines.SetRange([OrderNumber,0],[OrderNumber,999]);

I tried this...

     Globals.WkStrg := 'OrderNo = ' + IntToStr(OrderNumber) + ' And LineNo = 0';
     dm.SopHeads.Filter   := Globals.WkStrg;
     dm.SopHeads.Filtered := true;

     Globals.WkStrg := 'OrderNo = ' + IntToStr(OrderNumber) + ' AND LineNo BETWEEN 0 AND 999';
     dm.SopLines.Filter   := Globals.WkStrg;
     dm.SopLines.Filtered := true;

but it didn't work as expected.

  • Instead of "not the results I want" or "not as expected" it typically helps a lot if you describe what you actually got. An error? The wrong rows? A timeout? A reprimand from your boss? :P – Jeroen Mostert Nov 17 '22 at 20:55
  • And its always best to describe your actual requirements as opposed to I want to convert this code. – Dale K Nov 17 '22 at 22:20
  • I actually got 'Cannot perform this action on an empty dataset'. The dataset SOPLines (Order Lines) is not empty. My requirement is to restrict the range of records in SOPLines, (The lines of an order) to the current order that I am trying to insert into the SQL Server database. – Patrick Fleck Nov 18 '22 at 10:01
  • My requirement is to convert a program that uses the Paradox database to use SQL Server. As part of that requirement, I need to know the ADO equivalent of the Paradox Ttable.SetRange method. – Patrick Fleck Nov 18 '22 at 10:11

0 Answers0