Επεξεργασία

Κοινή χρήση μέσω


IDataEnvironment.BuildConnection(IWin32Window, DesignerDataConnection) Method

Definition

Creates a new data connection or edits an existing connection using the design tool's new connection user interface.

public:
 System::ComponentModel::Design::Data::DesignerDataConnection ^ BuildConnection(System::Windows::Forms::IWin32Window ^ owner, System::ComponentModel::Design::Data::DesignerDataConnection ^ initialConnection);
public System.ComponentModel.Design.Data.DesignerDataConnection BuildConnection (System.Windows.Forms.IWin32Window owner, System.ComponentModel.Design.Data.DesignerDataConnection initialConnection);
abstract member BuildConnection : System.Windows.Forms.IWin32Window * System.ComponentModel.Design.Data.DesignerDataConnection -> System.ComponentModel.Design.Data.DesignerDataConnection
Public Function BuildConnection (owner As IWin32Window, initialConnection As DesignerDataConnection) As DesignerDataConnection

Parameters

owner
IWin32Window

The parent window for the connection dialog.

initialConnection
DesignerDataConnection

The connection, if any, to edit. To create a new connection, initialConnection should be null.

Returns

A new or edited DesignerDataConnection object, or null if the user canceled.

Remarks

Use the BuildConnection method to activate the design environment's user interface for creating or editing data connections. If the initialConnection parameter is null, it indicates the user wants to create a new connection. If the initialConnection parameter is a DesignerDataConnection object, it indicates the user wants to edit an existing connection.

Your design environment is responsible for creating the data connection, adding the connection either to a global list of connections or to the Web application's configuration file, and adding the new connection to the Connections property.

The new connection should include the information that the application needs to create a data connection at run time. If you need to use the data connection in the design environment, use the GetDesignTimeConnection method to return a DbConnection object that will connect to the data store from the design environment.

If the user chooses to cancel the new connection creation process, the BuildConnection method should return null.

Applies to