Re: Stand Alone Recordsets
- From: Ilanio <Ilanio@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Thu, 18 Jan 2007 11:34:04 -0800
Note the sample code I made in VBScript:
'--------------------------------------------------
Set rst = CreateObject("ADODB.Recordset")
rst.CursorLocation = 3 ' adUseClient
rst.CursorType = 1 ' adOpenKeyset
rst.LockType = 3 ' adLockOptimistic
rst.Fields.Append "Name", 200, 255 ' adVarChar
rst.Open
rst.AddNew
rst.Fields.Item("Name").Value = "Ilanio"
rst.Update
rst.AddNew
rst.Fields.Item("Name").Value = "Kenia"
rst.Update
rst.AddNew
rst.Fields.Item("Name").Value = "Juliano"
rst.Update
rst.AddNew
rst.Fields.Item("Name").Value = "Claudia"
rst.Update
WScript.Echo rst.RecordCount '----> Displays 4
'Using filter property of recordset to select all names that starts by K:
rst.Filter = "Name LIKE 'K*'
WScript.Echo rst.RecordCount '----> Displays 1
'Remove filter
rst.Filter = 0
'Now I have another recordset
Set rts = CreateObject("ADODB.Recordset")
rts.CursorLocation = 3 ' adUseClient
rts.CursorType = 1 ' adOpenKeyset
rts.LockType = 3 ' adLockOptimistic
rts.Fields.Append "Name", 200, 255 ' adVarChar
rts.Open
rts.AddNew
rts.Fields.Item("Name").Value = "Ilanio"
rts.Update
rts.AddNew
rts.Fields.Item("Name").Value = "Kenia"
rts.Update
rts.AddNew
rts.Fields.Item("Name").Value = "Cristiano"
rts.Update
rts.AddNew
rts.Fields.Item("Name").Value = "Delane"
rts.Update
'Now I want to create a new recordset with data in the recordset 1 (rst)
'equals in the recordset 2 (rts)
'I try something like the code below withou success:
Set res = CreateObject("ADODB.Recordset")
res.CursorLocation = 3 ' adUseClient
res.CursorType = 1 ' adOpenKeyset
res.LockType = 3 ' adLockOptimistic
res.Open "SELECT rst.* FROM rst INNER JOIN rts ON rst.Name = rts.Name"
'The above line produces error
'Close and free recordsets variables
res.Close
rts.Close
rst.Close
cnn.Close
Set rst = Nothing
Set rts = Nothing
Set res = Nothing
Set cnn = Nothing
'---------------------------------------------
Any help is welcome...
Thanks
Ilanio
"Bob Barrows [MVP]" wrote:
Ilanio wrote:.
Hi, I'm using stand alone recordsets to manipulate data without a
database.
Ths sounds like an oxymoron. Are you really opening a recordset on a
database table then setting its activeconnection property to nothing to
disconnect it?
I have two stand alone
Again, please define "stand alone"
recordsets (recordset 1 and recordset 2) and
the data of these recordsets came from different sources.
These recordsets have some coincident fiedls (like name, gender,
etc.).
These recordsets have some data that are equal (duplicated) that I
need to find and show.
I'm trying to show these duplicated data using a third recordset
(stand alone of course) with a SQL query that uses INNER JOIN clause
from fields of the recordset 1 and recordset 2.
Is this possible?
No. You need a database engine to execute sql statements. None exists in
this situation. You will need to run nested loops.
--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"
- Follow-Ups:
- Re: Stand Alone Recordsets
- From: Bob Barrows [MVP]
- Re: Stand Alone Recordsets
- From: Stephen Howe
- Re: Stand Alone Recordsets
- References:
- Re: Stand Alone Recordsets
- From: Bob Barrows [MVP]
- Re: Stand Alone Recordsets
- Prev by Date: Re: Typed dataset: Time only data in SQL dateTime Field
- Next by Date: Re: Stand Alone Recordsets
- Previous by thread: Re: Stand Alone Recordsets
- Next by thread: Re: Stand Alone Recordsets
- Index(es):
Relevant Pages
|
Loading