DataConnectionCollection.Item 속성 (String)
컬렉션에서 이름을 사용하여 지정된 DataConnection 개체에 대한 참조를 가져옵니다.
네임스페이스: Microsoft.Office.InfoPath
어셈블리: Microsoft.Office.InfoPath(Microsoft.Office.InfoPath.dll)
구문
‘선언
Public MustOverride ReadOnly Default Property Item ( _
name As String _
) As DataConnection
Get
‘사용 방법
Dim instance As DataConnectionCollection
Dim name As String
Dim value As DataConnection
value = instance(name)
public abstract DataConnection this[
string name
] { get; }
매개 변수
- name
형식: System.String
가져올 DataConnection 개체의 이름입니다.
속성 값
형식: Microsoft.Office.InfoPath.DataConnection
지정된 개체입니다.
주의
Item 속성에서 반환하는 DataConnection 개체에 대한 참조를 설정한 경우에는 이 개체를 해당 데이터 연결에 대한 적절한 형식으로 캐스팅한 후 모든 해당 속성 또는 메서드에 액세스할 수 있습니다. 예를 들어 전자 메일로 양식을 전송하는 데 사용하는 데이터 연결의 속성 및 메서드에 액세스하려면 반환된 DataConnection 개체를 EmailSubmitConnection 형식으로 캐스팅해야 합니다.
이 멤버는 제한 없이 액세스할 수 있습니다.
이 형식 또는 멤버는 Microsoft InfoPath Filer 또는 웹 브라우저에서 연 양식에서 실행되는 코드에서 액세스할 수 있습니다.
예
다음 예제에서는 DataConnectionCollection에서 "Employees"라는 DataConnection 개체를 검색한 후 Access 또는 SQL Server 데이터베이스에서 데이터를 검색하는 데 사용할 데이터 연결을 나타내는 AdoQueryConnection 형식으로 캐스팅합니다.
// Get the Employees connection from the
// DataConnections collection.
AdoQueryConnection myAdoQueryConnection =
(AdoQueryConnection)(this.DataConnections["Employees"]);
' Get the Employees connection from the
' DataConnections collection.
Dim myAdoQueryConnection As AdoQueryConnection = _
DirectCast(Me.DataConnections("Employees"), AdoQueryConnection)