Registriert seit: 25. Apr 2007
Ort: Bergstrasse
49 Beiträge
Delphi 5 Professional
|
Re: Kein Zugriff auf Oracle Stored Proc mit Resultset
7. Aug 2008, 14:19
Nach weiterem Googlen & Nachdenken habe ich nun den Trick gefunden:
Delphi-Quellcode:
var conn: TADOConnection;
data: TADODataSet;
command: TADOCommand;
param: TParameter;
proc: TADOStoredProc;
row: Integer;
name: String;
begin
conn := TADOConnection.Create (nil);
conn.LoginPrompt := False;
conn.ConnectionString :=
'Provider=OraOLEDB.Oracle.1;'
+ 'Persist Security Info=True;'
+ 'Data Source=xxx;'
+ 'PwdChgDlg=0;'
+ 'Extended Properties="plsqlrset=1"';
conn.Open ('xxx', 'xxx');
name := Trim (Edit1.Text) + '%';
data := TADODataSet.Create (nil);
command := TADOCommand.Create (nil);
command.Connection := conn;
command.CommandType := cmdStoredProc;
command.CommandText := 'CURSOR_TEST.GetUserIDsAndNames';
command.Parameters.CreateParameter
('Name', ftString, pdInput, Length (name), name);
StringGrid1.RowCount := 0;
data.Recordset := command.Execute;
while not data.Eof do
begin
row := StringGrid1.RowCount;
StringGrid1.RowCount := StringGrid1.RowCount + 1;
StringGrid1.Cells [0,row] := data.Fields [0].AsString;
StringGrid1.Cells [1,row] := data.Fields [1].AsString;
StringGrid1.Cells [2,row] := data.Fields [2].AsString;
data.Next;
end;
data.Free;
command.Free;
conn.Close;
conn.Free;
end;
Alexander Stork
|
|
Zitat
|