ADO and QueryWinzard
Hi,
I need to work with ADO and QueryWinzard.
I try with this code but not work.
Help me please.
Thanks.
procedure ShowQueryWizard;
var connection: TStringList;
FSQL: TdaSQL;
FSession: TdaADOSession;
lDialog: TdaQueryDesignerForm;
begin
try
connection := TStringList.Create;
connection.LoadFromFile(ExtractFilePath(Application.exename) +
'connection.tmp');
FSession := TdaADOSession.Create(Nil);
FSession.GetDefaultADOConnection.ConnectionString := connection.Text;
FSQL := TdaSQL.Create(Nil);
FSQL.Session := FSession;
FSQL.AllowSelfJoin := True;
FSQL.DatabaseType := dtMSAccess;
lDialog := TdaQueryDesignerForm.Create(Nil);
lDialog.SQLClass := TdaSQL;
lDialog.SQL.Assign(FSQL);
lDialog.Initialize;
ldialog.AllowEditSQL := true;
if (lDialog.ShowModal = mrOK) then begin
FSQL.Assign(lDialog.SQL);
end;
finally
lDialog.Free;
FSession.Free;
FSQL.Free;
FSession := Nil;
FSQL := Nil;
connection.Free
end;
end;
I need to work with ADO and QueryWinzard.
I try with this code but not work.
Help me please.
Thanks.
procedure ShowQueryWizard;
var connection: TStringList;
FSQL: TdaSQL;
FSession: TdaADOSession;
lDialog: TdaQueryDesignerForm;
begin
try
connection := TStringList.Create;
connection.LoadFromFile(ExtractFilePath(Application.exename) +
'connection.tmp');
FSession := TdaADOSession.Create(Nil);
FSession.GetDefaultADOConnection.ConnectionString := connection.Text;
FSQL := TdaSQL.Create(Nil);
FSQL.Session := FSession;
FSQL.AllowSelfJoin := True;
FSQL.DatabaseType := dtMSAccess;
lDialog := TdaQueryDesignerForm.Create(Nil);
lDialog.SQLClass := TdaSQL;
lDialog.SQL.Assign(FSQL);
lDialog.Initialize;
ldialog.AllowEditSQL := true;
if (lDialog.ShowModal = mrOK) then begin
FSQL.Assign(lDialog.SQL);
end;
finally
lDialog.Free;
FSession.Free;
FSQL.Free;
FSession := Nil;
FSQL := Nil;
connection.Free
end;
end;
This discussion has been closed.
Comments
It looks like you need to assign the FSession.DataOwner property to "Self".
This may fix the issue. Below is an example that may help...
http://www.digital-metaphors.com/tips/LaunchQueryWizardInCodeADO.zip
--
Regards,
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com