DataConnection Object

Visio Automation Reference

Abstracts communication between one or more DataRecordset objects and a non-XML data source.

ms409166.vs_note(en-us,office.12).gif  Note
This Visio object or member is available only to licensed users of Microsoft Office Visio Professional 2007.

Version Information
 Version Added:  Visio 2007

Remarks

The default property of the DataConnection object is ID.

When you add a new DataRecordset object to the DataRecordsets collection (by using a method other than DataRecordsets.AddFromXML) and you do not specify an existing DataConnection object (by passing the connection string associated with it to the DataRecordsets.Add method), Visio creates a new DataConnection object.

The DataConnection object exposes properties that make it possible to access data-source connection settings:

  • The ConnectionString property gets or sets the connection string used to access an existing DataConnection object or to create a new DataConnection object. Note that setting this property to a new value does not immediately change the connection—Visio re-evaluates this property only when the DataRecordset.Refresh method is called.
  • The Timeout property determines how long (in seconds) Visio should attempt to establish a data-source connection before terminating the connection attempt and generating an error. The default is 15 seconds.
  • The FileName property gets or sets the name of the Office Data Connection (ODC) file that contains the data-source connection and query information used to create a new connection and to refresh data from an existing connection.

Multiple DataRecordset objects can share the same DataConnection object. When any of the data recordsets that share a data connection are refreshed, all are refreshed.

See Also