Solved

Problem with a TIBQuery component

Posted on 2013-11-29
3
361 Views
Last Modified: 2013-12-24
I have an application with a form on which I have a TIBQuery (and other TIB...) component named Query.
It is used everywhere I need to query the database (Firebird).
I use it since several years...
Now in some occasion (I don't know exactly when and why), it crashes on this :
Query.SQL.Clear
Error is : EIBClientError - Dataset open.
So I thought that somewhere else in my code, where I used the same Query, I forgot to do QUery.Close after Query.Open and processing to get result.
Without knowing where this was, I used this work around :
try
 Query.Close;
except
end;
This just before the Query.Clear but again it crashed exactly the same way
Help !
0
Comment
Question by:LeTay
  • 2
3 Comments
 
LVL 24

Accepted Solution

by:
jimyX earned 500 total points
ID: 39692355
Did you check if there is any under-process transaction before closing/clearing the SQL?
Try this one:
  if IBQuery1.Database.Connected then
    begin
      if not IBQuery1.Transaction.InTransaction then
        begin
          if IBQuery1.Active then
            begin
              IBQuery1.Close;
              IBQuery1.SQL.Clear;
            end
          else
            IBQuery1.SQL.Clear;
        end
      else
        ShowMessage('Wait for the current transaction to finish!!!');
    end;

Open in new window

0
 

Author Comment

by:LeTay
ID: 39694172
Will try that
But what is strange is that I have 8 "clients" running my application and two have now this problem permanently, when another has it from time to time.
Nothing "common" between them (same OS as mine and others)
0
 

Author Comment

by:LeTay
ID: 39694269
Hello jimyX
I will try your code
But what should my program do if the IBQuery1.Transaction.InTransaction is True in order to continue its normal operation (here, issue a Query ) ?
Thanks
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

948 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now