Düzenle

Aracılığıyla paylaş


ADOAdapter2.Command Property

Definition

Gets or sets the SQL command string text for an ADOAdapterObject object.

public:
 property System::String ^ Command { System::String ^ get(); void set(System::String ^ value); };
public string Command { get; set; }
member this.Command : string with get, set
Public Property Command As String

Property Value

Implements

Examples

In the following example, the Command property of the ADOAdapter 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 example requires my:field2 in the main data source and bound to a text box in a view that contains a 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.<span class="label">Command </span>= "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.Query();

Remarks

The Command property of the ADOAdapter object contains the SQL command text that is used by the ADO data adapter to submit data to and retrieve data from an ActiveX Data Objects/OLEDB external data source.

Note: The ADOAdapter object is limited to work only with Microsoft SQL Server and Microsoft Access databases.

Applies to