Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Tags Active Topics RSS Search Mark Forums Read

Thread Tools Search this Thread
Old 27-02-2009
Join Date: Aug 2008
Posts: 281
What are the advantages of disconnected record sets?


What are the advantages of disconnected record sets?
Reply With Quote
Old 27-02-2009
Join Date: Jan 2009
Posts: 10
Re: What are the advantages of disconnected record sets?

disconnected record gives more advantages in Database connection free.when user open a recordset using table/vew ,it will lock the table/view as user not free its.As result other user can't do any operation if table/view is not free.if we set ActionConnection=Nothing ,it free the table/view for other user.This creates database processing faster.
Reply With Quote
Old 27-02-2009
Join Date: May 2008
Posts: 115
Re: What are the advantages of disconnected record sets?

A disconnected Recordset, as its name implies, is a Recordset that lacks a connection.

seen that a Recordset that does not have a database connection can be very useful as a tool in your programming. It can save you time and effort and make your code more scalable.

In order to create a disconnected Recordset two Recordset properties must be set appropriately.
It is a requirement that the CursorLocation property is set to adUseClient and the LockType property is set to adLockBatchOptimistic. Note that the CursorType will default to adUseStatic if we don?t explicitly state that it should be set to adUseClient.) i.e

rst.LockType = adLockBatchOptimistic
rst.CursorLocation = adUseClient

However, we?ve recently discovered that these steps aren?t necessary. VB automatically assigns batch optimistic locking to newly created, connectionless recordsets. And, of course, without a connection, a recordset can?t have any other cursor but a client-side one. To create one of these structures, then, the only thing you need do is create the object variable instance. After that, you can simply begin adding fields to the construct.

To add fields, you use the Fields collection?s Append method. This method requires two parameters , the field name and the field data type. So, to create a connectionless recordset with two fields,you?d use code similar to:

Dim rst As ADODB.Recordset
Set rst = New ADODB.Recordset

rst.Fields.Append ?CustID?, adVarChar
rst.Fields.Append ?CustName?, adVarChar

Additional, optional Append method parameters include DefinedSize and Attrib. The DefinedSize argument takes the size of the field. Fill the Attrib parameter with constants that define additional field characteristics, such as whether it will allow null values or is updatable.
Since, in our technique, we want the fields to mirror the structure of the original recordset, we?ll simply use existing values for these parameters.

Disconnected Recordsets, first available with ADO 2.0, are the most commonly used mechanism to retrieve a Recordset and open a connection for only the necessary amount of time, thus increasing scalability. They are call disconnected because the connection to the database is closed.
The collections, properties, and methods of a disconnected Recordset are still available even though the connection is closed. This frees up server resources, given that the number of open connections is limited and database locking is a non-issue.
Reply With Quote

  TechArena Community > Software > Software Development
Tags: , ,

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Similar Threads for: "What are the advantages of disconnected record sets?"
Thread Thread Starter Forum Replies Last Post
?Modern Warfare 3′ sets day-one entertainment record Addis Web News & Trends 0 12-11-2011 10:33 AM
Character sets in MySQL Calan Software Development 5 09-12-2010 06:51 AM
Windows DNS server - force A record to update PTR record Peter Cumming Windows Server Help 1 27-05-2006 07:00 PM

All times are GMT +5.5. The time now is 08:41 PM.