Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

HOW IS THE RECORDSET KEPT OPEN WHEN USING ADO & SQL

Status
Not open for further replies.

TNN

Programmer
Sep 13, 2000
417
US
When using a data control or dataenvironment to create a recordset and bind controls the recordset is opened when the program starts. You can then use written procedures to refer to the recordset and manipulate the recordset such as MOVEFIRST, MOVELAST, ETC.

When using ADO with a SQL query to create a recordset how do you keep the recordset open so that other procedures can refer to it ????

Is this a dumb question?

TNN, Tom TNPAYROLL@AOL.COM [sig]<p>TOM<br><a href=mailto:WWW.TNPAYROLL@AOL.COM>WWW.TNPAYROLL@AOL.COM</a><br>[/sig]
 
Noway it is a dumb, rather a nice one. As you know, programming using DataEnvironment is easier than coding yourself, but you lose the performance and scalability factors when you use DE. Since the database connection reamins open, you are consuming the server resources and more importantly, one of the server's licenses. So first of all you should be sure what do you want (I mean keeping the connection open)

If you are sure enough, go on. Recordsets are automatically closed when the variable refering to them goes out of scope. For example if you declare and open an ADO connection in Form_Load event, the connection will be closed when the procedure exits. So you can keep it open by declaring it as public. For example you can add a standard module and declare a public variable for your database connection and recordset. The only remaining subject remaining is not to close the recordset and connection!!! But consider the matter of consuming server resources. If you are interested I can explain about this more. Take a look at different types of cursors (client-side and server-side) and also different types of locking)

Good luck. [sig]<p>Mohammad Mehran Nikoo<br><a href=mailto:mohmehran@yahoo.com>mohmehran@yahoo.com</a><br>MCP with experience in VB, ASP, XML, SQL, COM[/sig]
 
Thank You Mohammad,
I will experiment with what you gave me.
Again, Thanks
TNN, Tom
TNPAYROLL@AOL.COM [sig]<p>TOM<br><a href=mailto:WWW.TNPAYROLL@AOL.COM>WWW.TNPAYROLL@AOL.COM</a><br>[/sig]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top