Knight Data Access Layer
LoadTop(String,String,IEnumerable<Object>,String,Int32) Method
Example 




KellermanSoftware.NetDataAccessLayer Namespace > IDataHelper Interface > LoadTop Method : LoadTop(String,String,IEnumerable<Object>,String,Int32) Method
The name of the table
A SQL where clause
The parameters to use for the where clause
Order by SQL Clause
The maximum records to retrieve
Get a limited number of records for a table
Syntax
Overloads Function LoadTop( _
   ByVal tableName As String, _
   ByVal whereClause As String, _
   ByVal nameValueParameters As IEnumerable(Of Object), _
   ByVal orderBy As String, _
   ByVal maxRecords As Integer _
) As List(Of Dictionary(Of String,Object))
Dim instance As IDataHelper
Dim tableName As String
Dim whereClause As String
Dim nameValueParameters As IEnumerable(Of Object)
Dim orderBy As String
Dim maxRecords As Integer
Dim value As List(Of Dictionary(Of String,Object))
 
value = instance.LoadTop(tableName, whereClause, nameValueParameters, orderBy, maxRecords)

Parameters

tableName
The name of the table
whereClause
A SQL where clause
nameValueParameters
The parameters to use for the where clause
orderBy
Order by SQL Clause
maxRecords
The maximum records to retrieve
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 ('Stan','Man')");
db.ExecuteNonQuery("INSERT INTO Person (FirstName,LastName) VALUES ('Dan','Man')");
db.ExecuteNonQuery("INSERT INTO Person (FirstName,LastName) VALUES ('Dan','Abel')");
 
List<Dictionary<string, object>> list = db.LoadTop("Person", "WHERE FirstName = @FirstName", new object[] {"FirstName", "Dan" }, "ORDER BY LastName,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 ('Stan','Man')")
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 Dictionary(Of String, Object)) = db.LoadTop("Person", "WHERE FirstName = @FirstName", new object[] {"FirstName", "Dan" }, "ORDER BY LastName",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