-2

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?

James Z
  • 12,209
  • 10
  • 24
  • 44
bejarun
  • 175
  • 3
  • 11
  • Please recheck your query, must be something wrong with JOINS – Paresh J Mar 13 '15 at 05:46
  • There are so many possible problems, and you haven't given enough information for anyone to give an answer. Are you connecting to the same DB. Are your connection settings the same. In SQL Server, are you using the same schema/user? Do you really need BDE? It has officially been deprecated. – Disillusioned Mar 13 '15 at 08:54
  • Please, show your query so we can start to dig into it. – AlexSC Mar 13 '15 at 18:56

1 Answers1

2

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.