Link to home
Start Free TrialLog in
Avatar of TASINetwork
TASINetwork

asked on

Need info on Disconnected Record Sets (ADOR)

I've started working with ADOR and am loving it, but so far I don't know how to do a lot with it (I know how to add/delete/sort).  Does anyone know if a good website that talks about the commands?  I looked, but didn't come up with much.  I'm especially looking for a way to filter.
Avatar of leonstryker
leonstryker
Flag of United States of America image

Avatar of TASINetwork
TASINetwork

ASKER

I'm using vbscript and do not have VB, so I can't view the tutorial that you mentioned, do I don't know what it contains.

Here are a couple of the specifics that I'm looking for:
-Create a general filter
-Update a particular column of a record (IE: update a field of a specific row: say update an attribute field of a computer (the computer being the particular row).
>-Create a general filter

You can use the ADO Recordset Object Filter Property: http://www.vsai.org/caspdoc/Ch11_ADO115.html

>-Update a particular column of a record (IE: update a field of a specific row: say update an attribute field of a computer (the computer being the particular row).

If you are changing the value in the recordset, then all you have to do is assign it to the specific field. To record it back to the database, I would rather concatenate a SQL Update string and execute that.
Your stuff all deals with live ADO querying, I'm creating an offline ADOR DB that will never connect to an actual DB (I'm creating and working entirely with ADOR during my script life just for info storage).  Even in your recordset filter it deals specifically with a live ADO connection with a physical DB, which I'm not doing, so I don't know how to get it to work.


  hi,
   
  use following link to navigate about ado
 
  http://msdn.microsoft.com/library/default.asp?url=/library/en-us/ado270/htm/dasdkadooverview.asp

  for different connection string u will need to use db connection are available under
 following link
 
 http://www.connectionstrings.com/

 for further info just let me know

 Tushar

 
 
 
Still not much help.  Maybe it will help you understand what I'm doing if I post part of my code:

-----------------------------------
Const adVarChar = 200
Const MaxCharacters = 255

'Create Remoted Data Set
Set lstComputers = CreateObject("ADOR.Recordset")
lstComputers.Fields.Append "ComputerName", adVarChar, MaxCharacters
lstComputers.Fields.Append "RAM", adVarChar, MaxCharacters
lstComputers.Fields.Append "OS", adVarChar, MaxCharacters
lstComputers.Open

'GetComputerAccounts
{.....}
-----------------------------------

Now, I'm pulling in the field info, and I need to figure out how to add field info to a record of each computer (script creates a record listing all computers, then I want to go back and populate the fields for each computer).
Ah ok, I think this is that you are looking for:

    With lstComputers
        .AddNew
        .Fields(0).Value = "Comp1"
        .Fields(1).Value = "1M"
        .Fields(2).Value = "Windows XP"
    End With

This adds one record to your recordset. You can also use the field names instead:

        .Fields("ComputerName").Value = "Comp1"

Leon

now to add records use folllowing after opening recordset as u mentioned  

        lstComputers .AddNew
        lstComputers .Fields("ComputerName").Value = "name"
        lstComputers.Fields("RAM").Value = "memory size"
        lstComputers.Fields("OS").Value = "Windows"

        'TO DISPLAY
       
        Dim fldLoop As ADODB.Field
        Do While lstComputers.EOF = False
        For Each fldLoop In lstComputers.Fields
        Debug.Print fldLoop.name, fldLoop.Value
        Next fldLoop
        lstComputers.MoveNext
        Debug.Print "NEW RECORD"
    Loop
   lstComputers.Close

         
   now here instead of using debug.print use the thing on which u want to display it
 
   did i get u rite this time
   let me know
 
  Tushar
 
I've got adding items initially down, but I have some routines that I run against my whole list to get a particular attribute for each computer, so I need to -go back- and update each record.  This is the problem.  I need to find that particular row, then update the attributes.
nice,

 i assuming that u want to find a record in ur list ie. computer with the RAM=256

 then u have to fire select query
 
 like ..
 

  lstComputers .open "SELECT COMPUTER  FROM tableName where  RAM= 256 "
  lstComputers.Field("CPMPUTER")  IS the  computer u wanted
 
   u can access the other fields also as current position is the positionn u wanted in datbase
   by using recordset object

 NOW U CAN UPDATE IT
 
 lstComputer.Field("RAM")=128
 
 so done

 else u can serach whole db by using select * from table
 query  
 then add condition
 when u get required value for the attribute u looking for
 then update it
 use  loop till end of DB

 I think this is what u want

 Not Yet then let me know

Tushar
I tried doing a SQL query, but I get the following error every time:

ADODB.Recordset: The connection cannot be used to perform this operation. It is either closed or invalid in this context.

I'm thinking that it might be the tablename (but don't know for sure).  I am creating a record set, but I'm not using any commands to create table, so what would I use in the FROM section?

hi,

 i assumed that u have the table created ,
 anyway which db are u using?
 show the code from beginning ..
 so that i can trap error
 
 Tushar
This is how I'm creating it.  I guess it's just creating a recordset instead of a table.  Is there some other way that I should do this?

-----------------------------------------------------------
Const adVarChar = 200
Const MaxCharacters = 255

'Create Remoted Data Set
Set lstComputers = CreateObject("ADOR.Recordset")
lstComputers.Fields.Append "ComputerName", adVarChar, MaxCharacters
lstComputers.Fields.Append "RAM", adVarChar, MaxCharacters
lstComputers.Fields.Append "OS", adVarChar, MaxCharacters
lstComputers.Open
ASKER CERTIFIED SOLUTION
Avatar of tushar_comp
tushar_comp

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Well, I can't find anythink with ADOR to do exactly what I want, so I guess it's a limitation issue.  I think I may have to look for another solution, but at least what you showed gives me a way if I can't find a better solution.