DataRecordsets Collection

Visio Automation Reference

The collection of DataRecordset objects associated with a Document object.

ms409169.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 DataRecordsets collection is Item.

Every Visio 2007 Document object has a DataRecordsets collection, which is empty until you import data into Visio. To connect a Visio document to a data source, you add a DataRecordset object to the DataRecordsets collection of the document.

To add a DataRecordset object to the DataRecordsets collection, you can use one of the following three methods, depending on the type of data source you want to connect to (OLEDB/ODBC or XML) and how you want to pass connection string and query command strings to Visio. By using the

  • DataRecordsets.Add method, you can connect to an OLEDB or ODBC data source and pass connection and query command string information to Visio directly as method parameters.
  • DataRecordsets.AddFromConnectionFile method, you can connect to an OLEBD or ODBC data source by passing the method an Office Data Connection (ODC) file that contains the connection and query command string information you want to supply to Visio.
  • DataRecordsets.AddFromXML method, you pass the method an ADO classic XML string that contains all the data that you want to include in the data recordset.

Once you have created a data recordset, the connection string and query command string associated with the data recordset are represented by the DataConnection.ConnectionString and DataRecordset.CommandString properties respectively.

See Also