[Lazarus] Accessing MS SQLServer database from Lazarus/FPC?
Bo Berglund
bo.berglund at gmail.com
Sun Jan 23 00:15:35 CET 2011
On Sat, 22 Jan 2011 21:38:34 +0000, Mark Morgan Lloyd
<markMLl.lazarus at telemetry.co.uk> wrote:
>Bo Berglund wrote:
>
>> query.SQL.Text := 'EXEC SelectDongleData @SerialNo=2485';
>
>Having just spent a bit of time with Google and MS docs: is EXEC
>standard? What happens if you use CALL or EXECUTE? What happens if you
>use positional rather than named parameters?
>
'EXECUTE SelectDongleData @SerialNo=2485'
'EXECUTE SelectDongleData 2485'
Both work, but return only one record (there should be 4).
Or at least the code loop below only traverses once:
while not query.EOF do
begin
S := S + query.FieldByName('AppNo').AsString + #13#10;
query.Next;
end;
'CALL SelectDongleData 2485'
==> Exception: 'Cannot open a non-select statement'
Seems like SQLdb accepts EXECUTE in place of EXEC but when running the
call it fails to observe that more than one record is returned.
CALL is probably not recognized at all...
--
Bo Berglund
Developer in Sweden
More information about the Lazarus
mailing list