IDataEnvironment.GetDesignTimeConnection(DesignerDataConnection) 方法

定义

获取可以在设计时使用的数据库连接。Gets a database connection that can be used at design time.

public:
 System::Data::Common::DbConnection ^ GetDesignTimeConnection(System::ComponentModel::Design::Data::DesignerDataConnection ^ connection);
public System.Data.Common.DbConnection GetDesignTimeConnection (System.ComponentModel.Design.Data.DesignerDataConnection connection);
abstract member GetDesignTimeConnection : System.ComponentModel.Design.Data.DesignerDataConnection -> System.Data.Common.DbConnection
Public Function GetDesignTimeConnection (connection As DesignerDataConnection) As DbConnection

参数

connection
DesignerDataConnection

所需的数据连接。The desired data connection.

返回

DbConnection

一个可以在设计时使用的 DbConnection 对象。A DbConnection object that can be used at design time.

注解

GetDesignTimeConnection方法返回与控件设计器可以使用的数据存储区的有效连接。The GetDesignTimeConnection method returns a valid, open connection to the data store that can be used by the control designer.

控件设计器应使用 GetDesignTimeConnection 来获取数据连接,并且不应尝试使用属性打开连接 ConnectionStringControl designers should use the GetDesignTimeConnection to obtain a data connection and should not attempt to open a connection using the ConnectionString property.

适用于