Microsoft KB Archive/319984

= HOW TO: Link Shape Data in a Visio Drawing to a SQL Server Database =

Article ID: 319984

Article Last Modified on 1/9/2006

-

APPLIES TO


 * Microsoft Visio 2002 Professional Edition
 * Microsoft Visio 2002 Standard Edition
 * Microsoft Visio Network Center
 * Microsoft Visio Network Center

-



This article was previously published under Q319984



IN THIS TASK
SUMMARY How to Link Shape Data in a Visio Drawing to a Microsoft SQL Server 2000 Database
 * Export Visio Data to the Database
 * Link the Visio Drawing to the Database

REFERENCES



SUMMARY
This step-by-step article describes how to link shape data in a Microsoft Visio drawing to a Microsoft SQL Server 2000 database.

If you establish connections between shapes and database records, you can create Visio drawings that function as visual representations of data. After you establish a shape-record connection, you can create new shapes from database records, synchronize the data in your Visio drawing with the database, and, if you have write-access rights to the database, update the database from your Visio drawing.

Every Visio shape is described in its own ShapeSheet spreadsheet, which contains information about the shape's geometry and its other properties. If you link a shape to a database, you actually link cells in the shape's ShapeSheet spreadsheet to fields in a database table. Typically, you link a shape's custom properties to database fields.

back to the top

How to Link Shape Data in a Visio Drawing to a Microsoft SQL Server 2000 Database
To link shape data in a Visio drawing to a SQL Server 2000 database, follow these steps in the order in which they are presented.

Export Visio Data to the Database
To export data that is stored in shapes on a Visio drawing to a database, follow these steps:  Start Visio and then open the drawing that contains the shape data that you want to export. On the Tools menu, point to Macros, point to Visio Extras, and then click Database Export Wizard.

The Database Export Wizard starts. Click Next. Verify that the drawing that you want to export appears in the Choose a drawing or click Browse to open a drawing box, and then click Next. Specify the shapes in the drawing from which you want to export data, and then click Next. Specify the ShapeSheet cells and fields that you want to export to the database table, and then click Next. Do one of the following, as appropriate to your situation: <ul> If the Open Database Connectivity (ODBC) data source exists, click the data source in the Select an ODBC data source to export to list, and then click Next. Go to step 8.

-or-</li> If the ODBC data source does not exist, create it. To do so: <ol style="list-style-type: lower-alpha;"> Click Create data source.

The Create New Data Source Wizard opens.</li> Specify the type of data source that you want to create, and then click Next.</li> In the Select a driver for which you want to set up a data source list, click SQL Server, and then click Next.</li> Verify that the options that you selected are correct, and then click Finish.

The Create a New Data Source to SQL Server Wizard opens.</li> Type a name and description for the data source in the Name and Description boxes. In the Server box, specify the SQL server to which you want to connect, and then click Next.</li> Specify the options with which you want to verify the authenticity of the login ID, and then click Next.</li> Specify the database options that you want, and then click Next.</li> Specify the language settings and log options that you want, and then click Finish.</li> Verify that the options that you selected are correct, and then click OK.</li></ol> </li></ul> </li> Specify the name of the database table to which you want to export the shape data. Specify the type of data that you want in the key field, and then click Next.</li> Specify how you want the shape data to be interpreted in the database table, and then click Next.</li> If you want the option to re-export data to the database when you right-click a shape on the drawing page, click to select the Add export right mouse action to the drawing page check box. Click Next.</li> Verify that the options that you selected are correct, and then click Finish.</li></ol>

back to the top

Link the Visio Drawing to the Database

 * 1) On the Tools menu, point to Macros, point to Visio Extras, and then click Link to Database.
 * 2) In the Name box, click the name of the ODBC data source to which you want to connect, and then click OK.
 * 3) Right-click a shape on your drawing page.
 * 4) From the following options that appear on the shortcut menu, click the option that represents the action that you want to perform.
 * 5) * Select Database Record
 * 6) * Refresh Shapes Properties
 * 7) * Update Database Record
 * 8) * Delete Shape and Record

back to the top

<div class="references_section">