다음을 통해 공유


DataConnection.Execute 메서드

호출된 ConnectionTypeConnection 클래스에 따라 전송된 데이터, 쿼리 매개 변수 또는 검색할 데이터에 대해 선언적으로 정의된 값을 사용하여 데이터 연결에 대한 전송 또는 쿼리 작업을 실행합니다.

네임스페이스:  Microsoft.Office.InfoPath
어셈블리:  Microsoft.Office.InfoPath(Microsoft.Office.InfoPath.dll)

구문

‘선언
Public MustOverride Sub Execute
‘사용 방법
Dim instance As DataConnection

instance.Execute()
public abstract void Execute()

예외

예외 조건
WebException

실행 작업이 실패했습니다.

ArgumentNullException

이 메서드에 전달된 매개 변수가 Null 참조(Visual Basic의Nothing )입니다.

ArgumentException

이 메서드에 전달된 매개 변수가 유효하지 않습니다. 예를 들면 유형이나 형식이 잘못되었습니다.

InvalidOperationException

전송 작업을 위해 Loading 이벤트에 대한 이벤트 처리기에서 Execute() 메서드가 호출되었습니다.

SEHException

해당 관리 코드 예외에 매핑되지 않은 관리되지 않는 코드에서 SEH(구조적 예외 처리기) 오류가 발생했습니다. 자세한 내용을 보려면 MSDN 라이브러리에서 "관리되지 않는 예외" 및 "구조적 예외 처리"를 검색하십시오.

주의

양식 서식 파일을 디자인할 때에는 데이터 탭의 전송 작업 명령을 사용하여 전송 대상과 양식 서식 파일의 솔루션 정의 파일(.xsf)에 저장되는 관련 설정을 정의할 수 있습니다. 데이터 탭의 데이터 연결 명령을 사용하여 솔루션 정의 파일(.xsf)에 저장되는 데이터를 전송하고 받는 데 사용되는 설정을 정의할 수도 있습니다. Execute() 메서드를 사용하면 선언적으로 정의된 이러한 설정을 사용하여 데이터 연결에서 전송 또는 쿼리 작업을 수행할 수 있습니다.

DataConnection.Execute 메서드는 데이터 연결을 나타내는 모든 클래스에서 상속되며 EmailSubmitConnection.Execute() 메서드와 같이 해당 클래스의 상속된 메서드로 표시됩니다. 상속하는 클래스가 나타내는 데이터 연결의 종류에 따라 Execute 메서드는 해당 연결에 적합한 전송 또는 쿼리 작업을 수행합니다.

클래스

작업

AdoQueryConnection

쿼리

AdoSubmitConnection

전송

BdcQueryConnection

쿼리

BdcSubmitConnection

전송

EmailSubmitConnection

전송

FileQueryConnection

쿼리

FileSubmitConnection

전송

SharePointListRWQueryConnection

참고 사항참고 사항
InfoPath의 이전 버전에서 사용되던 SharepointListQueryConnection 클래스는 더 이상 사용되지 않습니다.

쿼리

WebServiceConnection

전송 또는 쿼리

이 멤버는 현재 열려 있는 양식과 같은 도메인에서 실행하는 양식 또는 도메인 간 권한이 부여된 양식에서만 액세스할 수 있습니다.

이 형식 또는 멤버는 Microsoft InfoPath Filer 또는 웹 브라우저에서 연 양식에서 실행되는 코드에서 액세스할 수 있습니다.

다음 예제에서는 ADOQueryConnection 클래스의 Command 속성을 사용하여 데이터 연결의 SQL 명령 텍스트를 업데이트한 후에 DataConnection 클래스의 Execute 메서드를 사용하여 양식에서 데이터를 새로 고치는 쿼리를 실행합니다.

public void RefreshData_Clicked(object sender, ClickedEventArgs e)
{
   // Get the Employees connection from the 
   // DataConnections collection.
   AdoQueryConnection myAdoQueryConnection =
      (AdoQueryConnection)(this.DataConnections["Employees"]);

   // Get the employee's ID from the EmpID field in 
   // the main data source.
   XPathNavigator myNav = 
      CreateNavigator().SelectSingleNode("/my:myFields/my:EmpID", 
      NamespaceManager);
   // Assign the value from the field to a variable.
   string employeeID = myNav.InnerXml;

   // Change the SQL command for Employees connection to retrieve 
   // the record of the Employee's ID entered by the user.
   myAdoQueryConnection.Command = 
      "select * from [Employees] where [EmployeeID] = " + employeeID;

   // Execute the updated command against the data connection to 
   // refresh the data.
   myAdoQueryConnection.Execute();
}
Public Sub RefreshData_Clicked(ByVal sender As Object, ByVal e As ClickedEventArgs)
   ' Get the Employees connection from the 
   ' DataConnections collection.
   Dim myAdoQueryConnection As AdoQueryConnection = _
      DirectCast(Me.DataConnections("Employees"), AdoQueryConnection)

   ' Get the employee's ID from the EmpID field in 
   ' the main data source.
   Dim myNav As XPathNavigator = _
      CreateNavigator().SelectSingleNode("/my:myFields/my:EmpID", _
      NamespaceManager)
   Dim employeeID As String = myNav.InnerXml

   ' Change the SQL command for Employees connection to retrieve 
   ' the record of the Employee's ID entered by the user.
   myAdoQueryConnection.Command = _
      "select * from [Employees] where [EmployeeID] = " + employeeID

   ' Execute the updated command against the data connection to 
   ' refresh the data.
    myAdoQueryConnection.Execute()
End Sub

참고 항목

참조

DataConnection 클래스

DataConnection 멤버

Microsoft.Office.InfoPath 네임스페이스