• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 384
  • Last Modified:

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.
0
TASINetwork
Asked:
TASINetwork
  • 7
  • 5
  • 3
1 Solution
 
TASINetworkAuthor Commented:
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).
0
 
leonstrykerCommented:
>-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.
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
TASINetworkAuthor Commented:
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.
0
 
tushar_compCommented:


  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

 
 
 
0
 
TASINetworkAuthor Commented:
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).
0
 
leonstrykerCommented:
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
0
 
tushar_compCommented:

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
 
0
 
TASINetworkAuthor Commented:
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.
0
 
tushar_compCommented:
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
0
 
TASINetworkAuthor Commented:
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?
0
 
tushar_compCommented:

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
0
 
TASINetworkAuthor Commented:
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
0
 
tushar_compCommented:

i have created soemthing realy basic
here without using table i m adding some entries in recordset then checking for the computer with the ram=256 , using while loop this is running ,donty forget to check "microsoft activex data object library 2.5 " in project> references ..done .... .  

''START

Private Sub Command1_Click()
Const adVarChar = 200
Const MaxCharacters = 255
Dim lstComputers As New ADODB.Recordset
'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
lstComputers.AddNew
lstComputers.Fields(0) = "Tushar"
lstComputers.Fields(1) = "128"
lstComputers.Fields(2) = "WinXp"
lstComputers.AddNew
lstComputers.Fields(0) = "john"
lstComputers.Fields(1) = "256"
lstComputers.Fields(2) = "WinXp"
lstComputers.MoveFirst

lstComputers.MoveFirst
While (lstComputers.EOF = False)
   If (lstComputers.Fields(1).Value = 256) Then
   Debug.Print ("your required computer is " & lstComputers.Fields(0).Value)
   End If
   lstComputers.MoveNext
Wend
   
   
End Sub

''END


Tushar
0
 
TASINetworkAuthor Commented:
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.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 7
  • 5
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now