Solved

Problem with a TIBQuery component

Posted on 2013-11-29
3
370 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

738 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