Wrox Home  
Search P2P Archive for: Go

  Return to Index  

pro_vb thread: ADO optimizing


Message #1 by Jason Peak <jason.peak@k...> on Wed, 31 Jan 2001 09:29:36 -0500
We have already covered that RECORDCOUNT is not always accurate and
therefore is unreliable... 

-----Original Message-----
From: Jason Peak [mailto:jason.peak@k...]
Sent: Wednesday, January 31, 2001 7:30 AM
To: professional vb
Subject: [pro_vb] ADO optimizing


I'm trying to get a list of optimizing techniques when working with ADO.
I've read a few biggies in the last couple of weeks and wonder how many
others I've not thought of or heard of before.  I'll start it off with a
couple:

1.  Use disconnected recordsets whenever using data in a read-only capacity
or when immediate updates of server data isn't critical.  To implement, set
the ActiveConnection of the recordset to Nothing once it's been opened.
Then, close the connection using cn.Close.

2.  Rather than using rs.EOF for looping through a recordset, define a
variable = rs.RecordCount.  Then use that value in a For...Next loop, like
such...
	lngRecordCount = rs.RecordCount
	For ThisLoop = 1 to rs.RecordCount
		'Code Here...
	Next ThisLoop

This little tip here will reduce looping time dramatically.  I've seen it
improve performance by 250%.

Hope these suggestions help and I'm looking forward to some new ones.




Jason W. Peak
Sr. Programmer
Klipsch Audio Technologies


  Return to Index