Compartilhar via


ADOAdapter2.Query Método

Definição

Lê dados do adaptador de dados associado.

public:
 void Query();
public void Query ();
abstract member Query : unit -> unit
Public Sub Query ()

Exemplos

No exemplo a seguir, o método Consulta do ADOAdapterObject objeto é usado para consultar a tabela Funcionários do banco de dados Northwind por meio da fonte de dados secundária "Funcionários". O EmployeeID do registro retornado corresponde ao valor do my:field2 nó. Este exemplo requer my:field2 na fonte de dados principal e vinculado a uma caixa de texto em uma exibição que contém o botão para invocar o seguinte código:

// 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>();

Comentários

A consulta falhará se QueryAllowed for falsa.

Aplica-se a