|
-
Mar 30th, 2006, 11:57 AM
#1
Thread Starter
Fanatic Member
Why we need to use more than one recordset in a app?
Hi,
Could somebody explain me the use and advantage of using more recordsets in an application.
-
Mar 30th, 2006, 12:35 PM
#2
Re: Why we need to use more than one recordset in a app?
Typically I will use one Public recordset throughout an application.
However, there are times when I need a second recordset for a specific issue. During those times, I will create an event level recordset, do what I need to do, then destroy it.
Often you may need certain elements of one recordset as variables in another query which would generate another recordset. Once you are done with both, then the temp recordset gets destroyed and you continue on with your primary recordset.
-
Apr 6th, 2006, 01:20 AM
#3
Re: Why we need to use more than one recordset in a app?
One Recordset may hold records from one table and another one holds records from a different table and you may need to perform some processing involving those records from the tables involved.
-
Apr 6th, 2006, 02:02 AM
#4
Re: Why we need to use more than one recordset in a app?
that depends your logic, comfortability and style...this is not mandatory to have one recordset in your app. Having so many recordsets also will cause problems if not closed properly...
If an answer to your question has been helpful, then please, Rate it!
Have done Projects in Access and Member management systems using BioMetric devices, Smart cards and BarCodes.
-
Apr 6th, 2006, 02:44 AM
#5
Re: Why we need to use more than one recordset in a app?
At best you may just instantiate one when you need it then properly dispose of it afterwards like the ff...
VB Code:
Private Sub SetContainerGrid(Optional ByVal ControlNum As String = vbNullString)
Dim adoRecordset As ADODB.Recordset
Dim strSQL As String
Dim li As ListItem
strSQL = "SELECT ContainerNum, ContainerSize, ID FROM BrokerageContainers WHERE ControlNum = '" & ControlNum & "'"
Set adoRecordset = New ADODB.Recordset
lvwContainers.ListItems.Clear
With adoRecordset
.Open strSQL, connImport, adOpenKeyset, adLockReadOnly
Do While Not .EOF
Set li = lvwContainers.ListItems.Add(Text:=.Fields("ContainerNum") & vbNullString)
li.Tag = .Fields("ID")
li.ListSubItems.Add Text:=.Fields("ContainerSize") & vbNullString
.MoveNext
Loop
.Close
End With
Set adoRecordset = Nothing
End Sub
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|