Articles   Members Online:
-Article/Tip Search
-News Group Search over 21 Million news group articles.
-Delphi/Pascal
-CBuilder/C++
-C#Builder/C#
-JBuilder/Java
-Kylix
Member Area
-Home
-Account Center
-Top 10 NEW!!
-Submit Article/Tip
-Forums Upgraded!!
-My Articles
-Edit Information
-Login/Logout
-Become a Member
-Why sign up!
-Newsletter
-Chat Online!
-Indexes NEW!!
Employment
-Build your resume
-Find a job
-Post a job
-Resume Search
Contacts
-Contacts
-Feedbacks
-Link to us
-Privacy/Disclaimer
Embarcadero
Visit Embarcadero
Embarcadero Community
JEDI
Links
Faster recordcount for sqlserver client/server applications Turn on/off line numbers in source code. Switch to Orginial background IDE or DSP color Comment or reply to this aritlce/tip for discussion. Bookmark this article to my favorite article(s). Print this article
21-Jul-03
Category
Database Others
Language
Delphi 2.x
Views
152
User Rating
No Votes
# Votes
0
Replies
0
Publisher:
DSP, Administrator
Reference URL:
DKB
			Author: Claudio Hira

When using the standard dataset.recordcount in my client-server (win nt against 
sqlserver7 db, targettable has 500.000 records) i can go for lunch and stil be 
waiting (:-

Answer:

For those of you who don't know why u should not use the standard 
dataset.recordcount when developing client server database applications. 
This article is especialy for those cs db apps against a sqlserver 7 db. 

since the standard dataset.recordcount iterates from begin of the table through the 
end of the table to result in the recordcount. This is a crime when developing cs 
db apps (against sqlserver7). 

simply use another way of obtaining the number of records. I use a sql for 
obtaining the number of records in a sqlserver table. 

drop a tquery on the form 

provide this tquery with the follow SQL: 

SQL: 

select distinct max(itbl.rows) 
from sysindexes as itbl 
inner join sysobjects as otbl on (itbl.id = otbl.id) 
where (otbl.type = 'U') and (otbl.name = :parTableName) 

notice the parameter: parTableName type string 

use this tquery to find out how many rows in the table 

TIP: try to make your own tYourSqlServerCountQuery and thus override the 
recordcount property. 
ByTheWay: use this only for sqlserver 

for other cs db apps simply use a count sql (coming upnext time...) 

			
Vote: How useful do you find this Article/Tip?
Bad Excellent
1 2 3 4 5 6 7 8 9 10

 

Advertisement
Share this page
Advertisement
Download from Google

Copyright © Mendozi Enterprises LLC