Share via


DataConnection Object (Visio)

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

Note

This Visio object or member is available only to licensed users of Microsoft Visio Professional 2010 or Visio Premium 2010.

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.