GetBySerialAsync
A part of the IQSDataTable interface, this method provides a way to retrieve a single record from a data source based on its serial number. Like GetByIdAsync, it allows callers to restrict the returned columns and runs asynchronously.
Asynchronously retrieves a DataTable from the underlying data source for a given unique decimal serial, with optional control over the returned columns.
Data retrieved from this method is for read-only purposes. The returned DataTable should not be modified directly. If modifications for the returned row are necessary, consider using GetRowByIdAsync() or GetRowBySerialAsync() methods to retieve a IQSDataTableRow object that can be edited and then saved back to the data source.
Signature
public async Task<DataTable> GetBySerialAsync(decimal serial, string TargetFields = "")Parameters
| Name | Type | Description |
|---|---|---|
serial | decimal | The unique serial number of the record to retrieve. Forwarded to the command builder. |
TargetFields | string (optional) | A comma‑separated list of column names to include in the result set. When empty or omitted, all columns are returned. |
Returns
A Task<DataTable> that represents the asynchronous operation. The DataTable contains the row matching the given serial, or an empty table if no match is found.
Example Usage
// Define the data table
IQSDataTable invoicesTable = QSAppContext.Tables["Invoices"];
//Define the serial number for the record to retrieve
decimal serialNumber = 5001;
// Retrieve full record
DataTable invoice = await invoicesTable.GetBySerialAsync(serialNumber);
// Retrieve only selected columns
DataTable limited = await invoicesTable.GetBySerialAsync(serialNumber, "InvoiceID,CustomerName,Amount");