Refresh Method (ADO)

Home | About me | EXCEL VB Programming (XL97-2003) | ACCESS Programming | EXCEL VB.Net Programming | EXCEL Spreadsheet Functions Material Management  |  Guestbook
 

ADO Refresh Method

The Refresh method accomplishes different tasks depending on the collection from which you call it.

Parameters
Using the Refresh method on the Parameters collection of a Command object retrieves provider-side parameter information for the stored procedure or parameterized query specified in the Command object. The collection will be empty for providers that do not support stored procedure calls or parameterized queries.

You should set the ActiveConnection property of the Command object to a valid Connection object, the CommandText property to a valid command, and the CommandType property to adCmdStoredProc before calling the Refresh method.

If you access the Parameters collection before calling the Refresh method, ADO will automatically call the method and populate the collection for you.

Fields
Using the Refresh method on the Fields collection has no visible effect. To retrieve changes from the underlying database structure, you must use either the Requery method or, if the Recordset object does not support bookmarks, the MoveFirst method.

Properties
Using the Refresh method on a Properties collection of some objects populates the collection with the dynamic properties that the provider exposes. These properties provide information about functionality specific to the provider, beyond the built-in properties ADO supports.

The Refresh Method applies to:
Axes Collection (ADO MD) Columns Collection (ADOX) CubeDefs Collection (ADO MD)
Dimensions Collection (ADO MD) Errors Collection (ADO) Fields Collection (ADO)
Groups Collection (ADOX) Hierarchies Collection (ADO MD) Indexes Collection (ADOX)
Keys Collection (ADOX) Levels Collection (ADO MD) Members Collection (ADO MD)
Parameters Collection (ADO) Positions Collection (ADO MD) Procedures Collection (ADOX)
Properties Collection (ADO) Tables Collection (ADOX) Users Collection (ADOX)
Views Collection (ADOX)    

Syntax:

collection.Refresh

Example:

Dim cat As ADODB.Command
Dim cat As New ADOX.Catalog
Set cmd = New ADODB.Command
Set cmd.ActiveConnection = conn
cmd.CommandText = "Select * From Customers"
cmd.CommandType = adCmdStoredProc
cmd.Parameters.Refresh
cmd.Properties.Refresh

  ' process further....
cat.Procedures.Refresh