I have one Delphi
application that connects to MS-SqlServer-2008R2
via BDE + ODBC
. Developed using Delphi 7
.
Accessing data using TDatabase, TTable, TQuery
components.
The TDatabase
is point to Alias name in BDE, and other components using the property TDatabase.Databasename
.
The main transaction table have more than 300 000 records.
in main application When I querying the table, the TQuery
gives record count as 2.5 million, but my table have only 300k record. After the query open application just crashed. what is the problem here?
If I debug the code , it gives "Memory Error"
at TQuery.Open
. but while running the application it not giving any error and just application got crashed.
I checked memory usage in Task manager before open the query is just 20 MB
, but after open the query the application using more than 700 MB memory
.
Copied the same query and run in SQL server management studio and get 45000 records.
Again just created one more small application with one form and one TQuery
, TDatabase
, and ran the query, it gives correct count 45000.
Why it giving unusual record count in main application?
Check the Database component property 'Params'. if any param is set with RowSet Size = -1. if it is there then remove it. This is the cause of the issue.