0

i use bde aliase and system datasources in odbce to connect ms sql server 2008 from delphi 7, some times 'connection is busy with another hstmt' error will occur,

is there any way to find which resultset not fetched all records?

how delphi create connection to mssql server,

bejarun
  • 175
  • 3
  • 11

2 Answers2

1

Every time you hit that error, is an indication of a bug in your code. You do not need to check for the state when the conneciton is busy simply because the conneciton should never be busy if you write your code correctly. Make sure you close every statement at the place you use it before allowing the code to continue.

Remus Rusanu
  • 288,378
  • 40
  • 442
  • 569
  • i developed application as follows: one data module contain 4 TDatabase components(for 4 database), all TTable components in my application used this Database components. In one form i just click Table.Append and Table.Cancel continually after click any other operation like first or next or last, it will say this error, this error occured only in particular places, but i fetched and closed un-necessary table and query components. even als the error appear. – bejarun Aug 13 '12 at 08:47
0

Best solution is to replace BDE with another DB access library, ADO or DBX for example.

OR you may avoid this error by calling Query.FetchAll after each Query.Open;

OR write a descendant class that will call FetchAll auto automatically, for example by adding OpenFetch method.

Marcodor
  • 4,578
  • 1
  • 20
  • 24