共用方式為


DataConnection Element

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

Syntax

<DataConnection
   ID
   FileName
   [ConnectionString]
   [Command]
   [Timeout]
   [AlwaysUseConnectionFile]>
</DataConnection>

Attributes

ID

Required unsigned integer. The ID assigned by Visio for a given connection, unique within the document.

FileName

Required string. The name of the connection file. See Remarks for more information.

ConnectionString

Optional string. The connection string that defines the parameters necessary to connect to a data source.

Command

Optional string. The command string used to query the data source.

Timeout

Optional unsigned long. The wait time in minutes while trying to establish a connection before terminating the attempt.

AlwaysUseConnectionFile

Optional Boolean. The default value is false. See Remarks for more information.

Element properties

Property

Value

Name

DataConnection

Minimum Occurrences

0

Maximum Occurrences

Unbounded

Element information

Parent elements

VisioDocument

DataConnections

Child elements

None

The FileName attribute can be one of the following:

  • The name of an Office Data Connection (ODC) file, if the connection was made by using an ODC file in the Visio user interface (UI).

  • The file name of a file-based data source, for example a Microsoft Excel or Microsoft Access file, if the connection was made in the UI.

  • Empty, if the data recordset was added programmatically.

If AlwaysUseConnectionFile is 0 (false), Visio does not search for an ODC file when data is refreshed. This permits refreshing data without an ODC file; however, it also means that the ODC file can be changed without your knowledge.

If AlwaysUseConnectionFile is 1 (true), Visio always searches for an ODC file first when data is refreshed.

See also

DataConnection object.