<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
<title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
I didn't wrote it explicite, I use FlameRobin and in SQL query with
SELECT I got nothing but EXECUTE PROCEDURE returns some rows.<br>
Using FlameRobin:<br>
'EXECUTE PROCEDURE ZNAJDZKODKRESKOWY('XXXXXXXX',0,0,0,7);' - one
row with data<br>
'SELECT * FROM
ZNAJDZKODKRESKOWY('XXXXXXXX',0,0,0,7);' - no rows
with data<br>
I don't know how to get result rows from 'EXECUTE ..' in Lazarus.<br>
<br>
Execution this code:<br>
SQLQuery1.SQL.Text := 'EXECUTE PROCEDURE
ZNAJDZKODKRESKOWY('+''''+'XXXXXXXX'+''''+',0,0,0,7);';<br>
SQLQuery1.Open;<br>
ShowMessage(SQLQuery1.FieldByName('ZLECENIE').AsString);<br>
SQLQuery1.Close;<br>
<br>
I got:<br>
'SQLQuery1: Cannot open a non-select statement'<br>
<br>
I think the problem is that my procedure is not "selectable"
and I don't know to handle with it.<br>
Is there a way to construct a SQL statment to be "selectable" or use
different code in Lazarus?<br>
<br>
Kamil<br>
<br>
<br>
Eduardo Lopez wrote:
<blockquote cite="mid:49CE5F48.1040402@yahoo.com.ar" type="cite">
<pre wrap="">Kamil:
The way is:
select * from ZnajdzKodKreskowy (....
//Asign parameters
qry1.open
//Read the results
This "open" the query and you can read the result from the stored
procedure (or loop reading it).
If you use 'Execute procedure ...' you must use qry1.ExceSQL because in
this case is for Stored Procedures that don't returns result.
Are you tried to do the "select * from ZnajdzKodKreskowy (...." in the
SQL query analizer (Flamerobin, IBExperte, etc. etc.)?
It works there?
Your Stored procedure is "selectable" ?
(<a class="moz-txt-link-freetext" href="http://firebird-with-delphi.blogspot.com/2007/07/fb-selectable-stored-procedure.html">http://firebird-with-delphi.blogspot.com/2007/07/fb-selectable-stored-procedure.html</a>)
I am a newbie too in Lazarus and have the same question some time ago,
and this list help me too, so i can confirm that this is the way :-)
Regards
Eduardo.
Kamil Walas escribió:
</pre>
<blockquote type="cite">
<pre wrap="">Hi,
I try before but it didn't work. This procedure work if Ido
'Execute procedure ZnajdzKodKreskowy (:Kod, 0, 0, 0, :IleCyfrSprawdzac) '
but if I do
'SELECT * FROM ZnajdzKodKreskowy (:Kod, 0, 0, 0, :IleCyfrSprawdzac)'
I got nothing. It simply doesn't work that way.
Code with:
qry01.SQL.Text:= 'Execute procedure ZnajdzKodKreskowy (:Kod, 0, 0, 0, :IleCyfrSprawdzac) ';
qry01.Open.Active := True;
I get erreor: 'Statment cannot be performed on non-select stetment' or
something like that and I must do
qry01.ExecSQL;
but I don't know how to get returning parameters in that kind of
instruction.
Kamil
Eduardo Lopez pisze:
</pre>
<blockquote type="cite">
<pre wrap="">Hi,
you must do a "select * from ZnajdzKodKreskowy (:Kod, 0, 0, 0,
:IleCyfrSprawdzac)"
The example:
qry01.SQL.Clear;
qry01.SQL.Text:= 'select * from ZnajdzKodKreskowy (:Kod, 0, 0, 0,
:IleCyfrSprawdzac)';
qry01.Params.ParamByName('Kod').AsString:= 'AAA';
qry01.Params.ParamByName('IleCyfrSprawdzac').AsString:= 'BBB'; // I
don't know what type are your paremeters :-)
qry01.Open;
MyResult01:=qry01.FieldByName('Jest').AsString;
MyResult02:=qry01.FieldByName('Zlecenie').AsString;
MyResult03:=qry01.FieldByName('...others...').AsString;
qry01.Close;
Have a nice weekend!
Eduardo.
Kamil Walas escribió:
</pre>
<blockquote type="cite">
<pre wrap="">Hi,
I have stored procedure in FireBird:
EXECUTE PROCEDURE ZnajdzKodKreskowy (:Kod, 0, 0, 0, :IleCyfrSprawdzac)
RETURNING_VALUES (:Jest, :Zlecenie, :I1, :I2, :I3, :I4, :D, :I5, :S);
I was trying to get returning values to lazarus code, but I couldn't. I
find out that there is no StoredProcedure element from Delphi. How could
I get this values? I would be pleased if someone wrote an example.
And sorry for my English.
Best regards,
Kamil Walas
_______________________________________________
Lazarus mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Lazarus@lazarus.freepascal.org">Lazarus@lazarus.freepascal.org</a>
<a class="moz-txt-link-freetext" href="http://www.lazarus.freepascal.org/mailman/listinfo/lazarus">http://www.lazarus.freepascal.org/mailman/listinfo/lazarus</a>
</pre>
</blockquote>
<pre wrap="">_______________________________________________
Lazarus mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Lazarus@lazarus.freepascal.org">Lazarus@lazarus.freepascal.org</a>
<a class="moz-txt-link-freetext" href="http://www.lazarus.freepascal.org/mailman/listinfo/lazarus">http://www.lazarus.freepascal.org/mailman/listinfo/lazarus</a>
</pre>
</blockquote>
<pre wrap="">_______________________________________________
Lazarus mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Lazarus@lazarus.freepascal.org">Lazarus@lazarus.freepascal.org</a>
<a class="moz-txt-link-freetext" href="http://www.lazarus.freepascal.org/mailman/listinfo/lazarus">http://www.lazarus.freepascal.org/mailman/listinfo/lazarus</a>
</pre>
</blockquote>
<pre wrap=""><!---->
_______________________________________________
Lazarus mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Lazarus@lazarus.freepascal.org">Lazarus@lazarus.freepascal.org</a>
<a class="moz-txt-link-freetext" href="http://www.lazarus.freepascal.org/mailman/listinfo/lazarus">http://www.lazarus.freepascal.org/mailman/listinfo/lazarus</a>
</pre>
</blockquote>
<br>
</body>
</html>