ADOAdapter2.Query Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Reads data from the associated data adapter.
public:
void Query();
public void Query ();
abstract member Query : unit -> unit
Public Sub Query ()
Examples
In the following example, the Query method of the ADOAdapterObject object is used to query the Employees table of the Northwind database through the secondary data source "Employees." The EmployeeID
of the record returned matches the value of the my:field2
node. This sample requires my:field2
in the main data source and bound to a text box in a view that contains the button to invoke the following code:
// retrieve the Employees Adapter from the DataAdapters collection
ADOAdapter employeesDA = (ADOAdapter)thisXDocument.DataAdapters["Employees"];
// get employee’s ID from the main DOM
string employeeID = thisXDocument.DOM.selectSingleNode("//my:field2").text;
// Change the ADOAdapter’s command to retrieve the record of the Employee’s ID entered
// by the user
employeesDA.Command = "select * from Employees where EmployeeID=" + employeeID;
// get DataObject from the DataObjects collection and call Query to refresh
// the data object
DataObject employeesDO = thisXDocument.DataObjects["Employees"];
employeesDO.<span class="label">Query</span>();
Remarks
The query fails if QueryAllowed is false.
Applies to
피드백
https://aka.ms/ContentUserFeedback
출시 예정: 2024년 내내 콘텐츠에 대한 피드백 메커니즘으로 GitHub 문제를 단계적으로 폐지하고 이를 새로운 피드백 시스템으로 바꿀 예정입니다. 자세한 내용은 다음을 참조하세요.다음에 대한 사용자 의견 제출 및 보기