Solved

Problem with a TIBQuery component

Posted on 2013-11-29
3
359 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
Comment Utility
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
Comment Utility
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
Comment Utility
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

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

771 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

10 Experts available now in Live!

Get 1:1 Help Now