Tutorial Downloads .com

Home

What are the Advantages of disconnected recordsets | VB Question

What are the Advantages of disconnected recordsets

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.


Resource:
Posted By : Naina
On date : 07.25.08

Most used Visual Basic ( VB ) Tutorials

Visual Basic Tutorial ( Ebooks , PDF's )
Visual Basic 6 Tutorial Download Visual Basic.Net Practical Standards For Microsoft Visual Basic Microsoft Visual Basic Design Patterns
VB Interview Questions & Answers
differences between flexgrid control and dbgrid, at is difference between inprocess and out of process, What is a Component?How to register a component?What are the Control Categories Difference between Dynaset and Snapshot? Difference Declaration and Instantiation an object? What is a Type Library and what is it's purpose ? What is DBFailError?What is DBSqlPassThrough? .... etc... etc....
What is the max size allowed for Msgbox Prompt and Input Box | Visual basic Question
What is the max size allowed for Msgbox Prompt and Input Box in VB
Microsoft Visual Basic 2008 Step by Step tutorial
This is a VB tutorial book which describes Microsoft Visual Basic 2008 Step by Step
Difference between a function and a subroutine | VB Interview question
Difference between a function and a subroutine
Difference between listbox and combo box | VB Interview question
Difference between listbox and combo box
Diff types of Lock Types in Vb
Diff types of Lock Types
What are the three main differences between flexgrid control and dbgrid(Data bound Grid) control
What are the three main differences between flexgrid control and dbgrid(Data bound Grid) control
Advantage of ActiveX Dll over Active Exe
Advantage of ActiveX Dll over Active Exe
DIFF between Image and Picture box controls | VB Question
DIFF between Image and Picture box controls?
ActiveX and Types of ActiveX Components in VB
ActiveX and Types of ActiveX Components in VB
Difference between Dynaset and Snapshot | VB Interview question
Difference between Dynaset and Snapshot
What are the RDO Methods and Events in VB
What are the RDO Methods and Events
Difference Query unload and unload in form | VB Interview question
Difference Query unload and unload in form
What is meant by "Early Binding" and "Late Binding" Which is better | Visual basic
What is meant by "Early Binding" and "Late Binding"? Which is better?

Latest added Visual Basic ( VB ) Tutorials

Microsoft Visual Basic 2008 Step by Step tutorial
This is a VB tutorial book which describes Microsoft Visual Basic 2008 Step by Step
What are the RDO Methods and Events in VB
What are the RDO Methods and Events
Diff types of Lock Types in Vb
Diff types of Lock Types
What is the max size allowed for Msgbox Prompt and Input Box | Visual basic Question
What is the max size allowed for Msgbox Prompt and Input Box in VB
What is the purpose of the ClipControls property on a form or container | VB Question
What is the purpose of the ClipControls property on a form or container
What is the difference in passing values ByRef or ByVal to a procedure | VB Question
What is the difference in passing values ByRef or ByVal to a procedure
Describe and In Process vs. Out of Process component. Which is faster | VB Question
Describe and In Process vs. Out of Process component. Which is faster
different compatibility types when creating a COM component | VB Interview Question
different compatibility types when creating a COM component
Name the four different cursor and locking types in ADO and describe them briefly
Name the four different cursor and locking types in ADO and describe them briefly
What are binary and project compatibility | VB Question
What are binary and project compatibility