Re: Stand Alone Recordsets



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"



.



Relevant Pages

  • Re: recordset.save takes too long!
    ... the Save Method "saves the Recordset in a ... the configuration I developed under fails to perform well at the client site ... The CursorType does affect performance. ... Using adOpenKeyset or adOpenStatic would be better ...
    (microsoft.public.vb.general.discussion)
  • Re: ADO recordset doesnt open adOpenKeyset Even though I specified it
    ... > I want to update a db from textboxes, so I created an ado recordset ... > adOpenStatic, instead of adOpenKeySet. ...
    (microsoft.public.vb.database.ado)
  • Re: Gebundene Controls aus ADO-Recordset aktualisieren
    ... Die Änderungen am Recordset erscheinen nur dann ... Wozu ein serverseitiger Cursor? ... DB-Typen mit CursorType adOpenKeyset ...
    (microsoft.public.de.vb.datenbank)
  • Re: Newbie Q: Cant update data in underlying table.
    ... The most often cause for a read-only query is a missing primary key. ... sure that the primary key has been set correctly by the upsizing wizard when ... I use ADO to bind the recordset after the user ... > recPic.Open strSQL, CurrentProject.Connection, adOpenKeyset, ...
    (microsoft.public.access.adp.sqlserver)
  • Re: Best way to find ID of new record
    ... lets call the first table Transaction ... Then I immediately want to open another no record recordset, ... Dim conWW As ADODB.Connection ... adOpenKeyset for the cursor type - I don't think this will affect you with ...
    (microsoft.public.data.ado)