[Lazarus] SQLdb not able to retrieve data from stored procedures?

Bo Berglund bo.berglund at gmail.com
Wed Jan 19 23:55:47 CET 2011


I am investigating Lazarus' capabilities for database work so I  have
made a very simple test application using ODBC and the SQLdb
components.
I am doing this on a Windows XP platform.

The code is a very slightly modified example that I got from the WIKI
here:
http://wiki.lazarus.freepascal.org/Lazarus_Database_Tutorial#Lazarus_and_MSSQL

My problem is that I get an exception on the query.Open line when the
SQL text is something like this:
 'EXEC SelectSomeData @Parameter=1234'

This is a stored procedure in an MSSQL Server database, which will
return a recordset similar to a SELECT statement only the actual
selection mechanism may be very complex and is located in a stored
procedure for performance reasons.
We build all our database manipulations this way to gain speed and
ease support.

However the TSQLQuery object seems unable to return these data for
some obscure reason.

I have tried to read up but not found a solution, for example here:
http://wiki.lazarus.freepascal.org/SQLdb_Package
A bit down the page it says:

TSQLQuery
This is a descendant of TDataset, and provides the data as a table
from the SQL query that you submit. But can also be used to execute
SQL-queries that don't return any data. 

Does this mean that the query MUST be table oriented and only use
SELECT statements if data are to be returned???

What I have here are executable procedures that DO return data just
like any SELECT statement....

What to do?


-- 
Bo Berglund
Developer in Sweden





More information about the Lazarus mailing list