Megosztás a következőn keresztül:


Read Operation

Reads a single record.

Note

The signature of an operation changes if the page contains one or more unbound fields in the root content area. If there are unbound fields, then the names from the SourceExpr property for the unbound fields are added as the first parameters to the operation. They are added according to the tab order of the page. For an example, see the Item Journal.

Method Signature

Entity Read(string no)

Parameters

Parameter Description
no Type: String

The primary key of the requested record.

This argument is a filter on the primary key and returns the first record that matches the filter. When special characters, such as an apostrophe, equal sign, or ampersand, are part of the key, you must enclose the argument with quotation marks.

For example, when you write C# code, you should use standard quotation marks for strings and also use additional single quotation marks around a value, such as "'A&B'".

Results

Result name Description
entity Type: Entity

A variable of a specific object type that represents the page. Contains the latest values that are present on the page.

If the record with the given primary key does not exist, then no value is returned. In the .NET Framework, a null reference is returned.

Faults

This operation does not return a fault when a matching record is not present. Instead, it returns no value. In C#, you should test whether the result is a null reference. Otherwise, you may get a NullReferenceException exception.

Faults are possible if they are generated by the C/AL code.

Usage Example

Customer customer = new Customer();  
customer.Name = "Customer Name";  
service.Create(ref customer);  
customer = service.Read(customer.No);  

See Also

Basic Page Operations