Hi Guys,
I am fighting with a piece of Code and can not move Forwards, do you a have a hint for a Delphi
SQL beginner?
I want to extract a list of names from a Database for making a return in my function and after that passing that to another function in my big program.
1. I tried following Code making a big program and I got my
csv table with the column of names, but if I try to separate my big program in Little modules, it does not work any more
I got by Debugging a run time error E/AFehler 103 when evaluating the instruction PushVar($0,$0,0,$0,$0,'Result'9. in the Position: (***)
I am sure it is a very stupid Thing, but I cannot catch it now.
2. it is possible to Export this Little
query to assign it to my fn1 result for passing this value to the function fn2?
thnaks a lot in Advance and Kind regards
Piedad
function fn1:String;
var
...
qryPMV := TQuery.Create(nil);
tsSQLListe := TStringList.create;
qryPMV.DatabaseName := '
DB';
qryPMV.Close;
qryPMV.Sql.Clear;
qryPMV.Sql.Add('SELECT Distinct column1 PMV ');
qryPMV.Sql.Add('FROM MMV_DB ');
qryPMV.Sql.Add('Order by PMV ');
strSQL := qryPMV.Sql.GetText;
qryPMV.Open;
if not (qryPMV.bof and qryPMV.eof) then
begin
strHeader := 'PM_guys';
Writeln(tfFilePointer, strHeader); (***)
WHILE not qryPMV.EOF do
begin
strOutputZeile := '';
tsSQLListe.Add(cTrenner + qryPMV.FieldByName('PM_VERANTWORTLICHER').AsString );
strPPV := StringReplace(tsSQLListe.text, cCRLF, cDelimiter, 1);
strOutputZeile := strPPV;
tsSQLListe.Clear;
Writeln(tfFilePointer, strOutputZeile);
qryPMV.next;
end;
end;
CloseFile(tfFilePointer);