var
blob: TStream;
outstream: TMemoryStream;
Query: TADOQuery;
begin
DM_Main.ADOTableRaw.Close;
DM_Main.ADOTableRaw.TableName := '
KO_STATIONSTYP';
DM_Main.ADOTableRaw.IndexFieldNames := '
STATIONSTYP';
DM_Main.ADOTableRaw.Filter := '
STATIONSTYP = ''
' + DM_KSB.ADOQueryBestellung['
STATIONSTYP'] + '
''
';
DM_Main.ADOTableRaw.Filtered := TRUE;
DM_Main.ADOTableRaw.Open;
if DM_Main.ADOTableRaw['
BEDIENUNGSANLEITUNG'] <> '
'
then
begin
blob := DM_Main.ADOTableRaw.CreateBlobStream(DM_Main.ADOTableRaw.FieldByName('
BEDIENUNGSANLEITUNG'), bmRead);
blob.Seek(0, soFromBeginning);
outstream := TMemoryStream.Create;
outstream.LoadFromStream(blob);
outstream.Seek(0, soFromBeginning);
DM_Main.ADOQueryRaw.Close;
DM_Main.ADOQueryRaw.SQL[1] := '
SYSFORM.KOBUSYS_VERLAUF';
DM_Main.ADOQueryRaw.SQL[3] := '
BEDIENUNGSANLEITUNG';
DM_Main.ADOQueryRaw.SQL[5] := '
WHERE ID';
//DM_Main.QueryRaw.ParamByName('p_pdf').SetBlobData(outstream.Memory, outstream.Size);
DM_Main.ADOQueryRaw.Parameters.ParamByName('
p_pdf').LoadFromStream(outstream.Memory, ftBlob);
DM_Main.ADOQueryRaw.Parameters.ParamByName('
p_auftragsnummer').Value := inttostr(DM_KSB.ADOQueryBestellung['
ID']);
DM_Main.ADOQueryRaw.ExecSQL;
outstream.Free;
blob.Free;
end;