[Lazarus] Accessing MS SQLServer database from Lazarus/FPC?

Bo Berglund bo.berglund at gmail.com
Mon Jan 24 18:49:11 CET 2011


On Sun, 23 Jan 2011 12:06:12 +0100 (CET), Michael Van Canneyt
<michael at freepascal.org> wrote:

>
>On Sat, 22 Jan 2011, Bo Berglund wrote:
>
>> On Fri, 21 Jan 2011 17:30:57 +0100 (CET), michael.vancanneyt at wisa.be
>> wrote:
>>
>>> Without the error message, we cannot begin to start looking for a solution.
>>>
>>> Michael.
>>
>> I can now answer that after I have restarted the virtual machine where
>> I was investigating this:
>>
>> The error message captured as the Exception.Message is:
>>
>> 'Cannot open a non-select statement'
>
>Attached is a possible patch. I don't have MS-SQL (doesn't run on Linux) so I can't test.
>Please apply it to packages/fcl-db/src/sqldb/sqldb.pp and report whether this helped you 
>solve your problem. If so, I will commit it to SVN.
>

Returning to the patch.

I have applied it to the sqldb.pp file I found in the FPC sources,
then followed Graeme G's advice to add this folder to the project
options so it would be recompiled.
So now I believe that I have actually succeeded in getting the patch
to work.

What happens now is that no exception is raised at all. :-)

But, the recordset I get contains only one record even though I *know*
there should be 4. If I use the MSSQLServer Query Analyzer and send
the same command I get 4 records.

So now the EXEC verb is accepted by the query.Open method, but it
seems to not set its returned records count correctly, thus losing all
but the first record.

Half done, I would say...

I tried to use the debugger and "step into" the query.Open method to
see what was going on but it seems like this is not allowed by
lazarus, it does just like I had clicked "step over".



-- 
Bo Berglund
Developer in Sweden





More information about the Lazarus mailing list