Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I edit after ORDER BY? Th 2

Status
Not open for further replies.

delphiman

Programmer
Dec 13, 2001
422
ZA
How do I edit after ORDER BY?

The following works but then I lose the ability
to edit records. Can someone please tell me
how to rectify this.

procedure TfrmContacts.btnOrderClick(Sender: TObject);
begin
DMCntcts.Query1.SQL.Clear;
DMCntcts.Query1.SQL.Add ('SELECT *');
DMCntcts.Query1.SQL.Add ('FROM "c:\h\StdCont\Tables\Cntcts.db"');
DMCntcts.Query1.SQL.Add ('ORDER BY CoName');
DMCntcts.Query1.Active := True;
end;
 
Hi Terry if you are using the TQuery,

DMCntcts.Query1.RequestLive := True;
should do the trick

Regards
Steven van Els
SAvanEls@cq-link.sr
 
>DMCntcts.Query1.RequestLive := True;
should do the trick

Negative. :-(
I already have Propery.Query1RequestLive := True
via the OI.

And if I put a BreakPoint there it is shown as being True.

I have also tried using a QueryUpdate component with
all the Modify, Delete and Insert SQL routines filled in.

But it still doesn't work. I lose the edit property the
moment I do the above ORDER BY.

Any more thoughts?
 
Soory for putting this on top of the list again! :)
But I'm still baffled by this.

Any ideas? Anyone)) :)
 
You are using the Ibx components for the connection I guess, I will take a closer look at it. Steven van Els
SAvanEls@cq-link.sr
 
Use TIBDataSet. Write your InsertSQL and ModifySQL and enjoy.

--- markus
 
S.Van Els
>You are using the Ibx components for the connection I guess, I will take a closer look at it.

Negative. I'm using plain old common-or-garden TTable and TQuery components. :)

marcus
>Use TIBDataSet. Write your InsertSQL and ModifySQL and enjoy.

I'm using a Paradox data-base. :) See above.
But I am familiar with these two components (since I also use Interbase SqlServer) and will try them. Might mention I have also tried TUpDateSQL (which is where I think your are going) - but that didn't work either.

Any more guru's out there? :) :)

 
Try using an index to get the order you want. Using that should preserve your ability to update the records.
 
Perhaps you can elaborate?

I have now indexed CoName so that
CoName is always alphabetic in my
grid without the above EventHandler even
being required.

But if I do the following I still
have the same problem. Even with S.VanEls's
suggested DMCntcts.Query1.RequestLive := True;
(Which a BreakPoint reveals to be True anyway.)

procedure TfrmContacts.dbeFiltSubjectDblClick(Sender: TObject);
begin
DMCntcts.Query1.SQL.Clear;
DMCntcts.Query1.SQL.Add ('SELECT *');
DMCntcts.Query1.SQL.Add ('FROM "c:\h\StdCont\Tables\Cntcts.db" t2, "c:\h\StdCont\Tables\FTable.db" t1');
DMCntcts.Query1.SQL.Add ('WHERE t2.Subject = t1.Subject');
DMCntcts.Query1.SQL.Add ('ORDER BY CoName');
DMCntcts.Query1.RequestLive := True;
DMCntcts.Query1.Active := True;
end;
 
Terry it looks like you are not using the BDE

DMCntcts.Query1.SQL.Add ('FROM "c:\h\StdCont\Tables\Cntcts.db" t2, "c:\h\StdCont\Tables\FTable.db" t1');


Another thing, if you make a combined query (I see two tables) for you to edit the query, the data must be from one dataset (table).

Regards
Steven van Els
SAvanEls@cq-link.sr
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top