Knight Data Access Layer
LoadTop<T>(Int32) Method
Example 




KellermanSoftware.NetDataAccessLayer Namespace > IDataHelper Interface > LoadTop Method : LoadTop<T>(Int32) Method
Generic class type
Number of records to retrieve
Load Top N Records
Syntax
Overloads Function LoadTop(Of T As {Class, New})( _
   ByVal records As Integer _
) As List(Of T)
Dim instance As IDataHelper
Dim records As Integer
Dim value As List(Of T)
 
value = instance.LoadTop(Of T)(records)
List<T> LoadTop<T>( 
   int records
)
where T: class, new()
List<T*>* LoadTop<T>( 
   int records
) 
where T: ref class, gcnew()
List<T^>^ LoadTopgeneric<typename T>
( 
   int records
) 
where T: ref class, gcnew()

Parameters

records
Number of records to retrieve

Type Parameters

T
Generic class type
Example
//Get the current thread static safe instance of the helper
IDataHelper db = DataHelper.SessionFactory();
 
//Specify User Name and License Key from the receipt, leave blank for trial mode
//db.UserName = "John Smith 1234";
//db.LicenseKey = "asdfl219==";
 
db.ExecuteNonQuery("INSERT INTO Person (FirstName,LastName) VALUES ('Dan','Man')");
db.ExecuteNonQuery("INSERT INTO Person (FirstName,LastName) VALUES ('Dan','Abel')");
 
List<Person> list = db.LoadTop<Person>(1);
'Get the current thread static safe instance of the helper
Dim db As IDataHelper = DataHelper.SessionFactory()
 
'Specify User Name and License Key from the receipt, leave blank for trial mode
'db.UserName = "John Smith 1234"
'db.LicenseKey = "asdfl219=="
 
db.ExecuteNonQuery("INSERT INTO Person (FirstName,LastName) VALUES ('Dan','Man')")
db.ExecuteNonQuery("INSERT INTO Person (FirstName,LastName) VALUES ('Dan','Abel')")
 
Dim list As List(Of Person) = db.LoadTop(Of Person)(1)
Requirements

Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also

Reference

IDataHelper Interface
IDataHelper Members
Overload List