Joost van der Sluis wrote:
Op donderdag 24-01-2008 om 20:56 uur [tijdzone +1100], schreef John:
Joost van der Sluis wrote:
Op donderdag 24-01-2008 om 00:09 uur [tijdzone +1100], schreef John:
Snip
It does, in so far as the parameter specs are now retained, but now the database property of sqlquery is not read, so it still can't work properly. In fact, I can't even set the database from the Lazarus object inspector.
Huh? Are you sure? Did you recompile everything correclty?
You won't often catch me saying "Yes I am *sure* I compiled everything correctly" ! I think I did, though.

Quick test is to add a new writeln, see if it is triggered. If so you
have rebuild it properly.

This is my version of set database:

It doesn't contain a call to Inherited.SetDatabase. I think that that is
your problem now.

procedure TCustomSQLQuery.SetDatabase(Value : TDatabase);

var db : tsqlconnection;

begin
  if (Database <> Value) then
    begin
    {$IFDEF DBDEBUG}
    if dbdbgOn then
      Writeln(dbdbg, 'TCustomSQLQuery.database is being set to "',
                     Value.DatabaseName, '".');
    {$ENDIF}
    if assigned(value) and not (Value is TSQLConnection) then
      DatabaseErrorFmt(SErrNotASQLConnection,[value.Name],self);

Add   '  inherited setdatabase(value);'


    if not (csLoading in ComponentState) then
      begin
      UnPrepare;
if assigned(FCursor) then TSQLConnection(DataBase).DeAllocateCursorHandle(FCursor);
      db := TSQLConnection(Value);
if assigned(value) and (Transaction = nil) and (Assigned(db.Transaction)) then
        transaction := Db.Transaction;
      {$IFDEF DBDEBUG}
      if dbdbgOn then
        Writeln(dbdbg, 'Calling TCustomSQLQuery.OnChangeSQL because ',
                       'TCustomSQLQuery.database has been set to "',
                       Value.DatabaseName, '".');
      {$ENDIF}
      OnChangeSQL(Self);
      end;
    end;
end;

Joost

YES! It works!

I was tempted to write down the details of my adventures and why it took so long to get to this point, but I guess that will just bore everyone. Suffice to say that most were about learning to use the SVN environment, and not much to do with the above problem. I think I may have achieved a functioning SVN environment now.

So now I have the parameter query opening when the form opens, and also have a master/client link between two sqlqueries, without requiring code. (Previously I always seemed to need an 'AfterScroll' handler to get it to work).

I will see what further trouble I can get into.

Thanks,
John Sunderland

_________________________________________________________________
    To unsubscribe: mail [EMAIL PROTECTED] with
               "unsubscribe" as the Subject
  archives at http://www.lazarus.freepascal.org/mailarchives

Reply via email to