Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1034315
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T14:22:17+00:00 2026-05-16T14:22:17+00:00

I need to call some Stored Procedures from Delphi and because they are related

  • 0

I need to call some Stored Procedures from Delphi and because they are related I have to use transactions.
But It always returns an error when called :

‘Transaction cannot have multiple recordsets with this cursor type. Change the cursor type ,commit the transaction, or close one of the recordsets.’

And this error only occurs for MS SQL SERVER 2008, when I use MS Access It works fine.
Whats the problem ?

Thanks in advance

UPDATE :

procedure TForm1.Button2Click(Sender: TObject);  
begin  
    if not DM.ADOConnection.InTransaction then  
        dm.ADOConnection.BeginTrans;  
    ADOQuery.LockType := ltBatchOptimistic;  
    ADOQuery.CursorType := ctUnspecified;  
    Try  
        with ADOQuery do  
        begin  
            Close;  
            SQL.Clear;  
            SQL.Text := 'INSERT INTO [UserAction] (UAct_Frm_ID,UAct_Type,UAct_Description'  
              +',UAct_Date,UAct_Time,UAct_Usr_ID)'
              +'VALUES(:UAct_Frm_ID'
              +',:UAct_Type,:UAct_Description,:UAct_Date,:UAct_Time'
              +',:UAct_Usr_ID)';
  Parameters.ParamByName('UAct_Frm_ID').Value := 1;
  Parameters.ParamByName('UAct_Type').Value := 1;
  Parameters.ParamByName('UAct_Description').Value := 'test by Q1';
  Parameters.ParamByName('UAct_Date').Value := completdate(datenow);
  Parameters.ParamByName('UAct_Time').Value := TimeToStr(Now);
  Parameters.ParamByName('UAct_Usr_ID').Value := 1;
  ExecSQL;
  end;
  Except
    DM.ADOConnection.RollbackTrans;
    ShowMessage('RollBack');
    Exit;
  End;
  dm.ADOConnection.CommitTrans;
  ShowMessage('Commite');
end; 
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T14:22:17+00:00Added an answer on May 16, 2026 at 2:22 pm

    From here:

    Resolution:

    Use a different cursor type, change
    the cursor location to adUseClient or
    close the first recordset before
    opening another on the same
    connection/transaction.

    Cause:

    SQL Server can only open one
    ForwardOnly cursor at a time on a
    connection, because SQL Server can
    only process one active statement at a
    time per connection.

    When you try to open more than one
    ForwardOnly ADO recordset at a time on
    a single Connection, only the first
    ADO recordset is actually opened on
    the Connection object. New, separate
    connections are created for subsequent
    ForwardOnly cursors.

    A transaction is on a single
    connection. When you attempt to open
    more than one ForwardOnly recordset
    within a single transaction, ADO
    attempts to open more than one
    ForwardOnly recordset on the
    connection of the transaction. An
    error occurs because SQL Server only
    allows one ForwardOnly recordset on a
    single connection. Because the error
    is within a manual transaction, you
    might see the error above. Microsoft
    Data Access Objects 2.1 Service Pack 2
    and later versions of MDAC contain
    more informative error messages. For
    that reason, you may see the more
    informative second or third error
    message, above.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to call some jQuery .load() function from flash. i Use this: import
I need to call some PL/SQL procedures from my Java application. I can do
I need to call some stored procedures via NHibernate (not necessarily for CRUD-operations). Is
I need to use stored procedure to get data from DB, but I would
I need to call some methods in Wininet.dll from a Java program. I can
I need to call from my code for some other program . And I
I am using Entity Framework 4.1 and do sometimes need to call stored procedures.
I have sybase stored procedures that I have written which we use in our
I want to use some smart procedures I wrote, but not store them. For
I need to run a stored procedure from a C# application. I use the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.