Page 1 of 1

Firebird 2.1 Embedded, error -501 on close

Posted: 27.03.2013, 15:44
by mafro_cz
Hi,

I use Firebird 2.1 embedded (protocol: firebirdd_2.1) and in this code:

Code: Select all

     With TZReadOnlyQuery.create(nil) do begin
          Connection:=ZConnection2;
          Close;
          with UserPropertyForm do begin
               SQL.Clear;
               SQL.Add('Insert InTo SPRAVCI (UserName,UserPass) values('''+NewUserEdit.text+''','''+NewPasswordEdit.text+''') returning IDSpravci;');
               Open;
               Result:=FieldByName('Idspravci').asInteger;
               end;
          close;
          Free;
          end; //with ReadOnlyQuery
get error -501 on the last close.

On Firebird 2.1 server (protocol firebird_2.1) it is ok.

Can someone help me where is problem and how to correct it?

I'm using version 7.0.3-stable and XE.

Thanks in advance.

Posted: 28.03.2013, 09:34
by marsupilami
Hello mafro_cz,

What is the message of the -501 error, you get? These SQL-Codes tend to be quite ambigous. This applies to the -501 error too - it has at least two possible meanings.

If you need an immediate solution and it works, I can only suggest to use firebird_2.1 now and use the LibraryLocation property of TZConnection to point to the embedded library.

Best regards,

Jan

Posted: 28.03.2013, 18:05
by mafro_cz
error -501 is:

Code: Select all

... exception class EZSQLException with message 'SQL Error: Dynamic SQL Error SQL error code = -501 Attempt to reclose a closed cursor. Error Code: -501. The cursor identified in a FETCH or CLOSE statement is not open.'.