Knight Data Access Layer
LoadFromSproc<T>(String,Dictionary<String,Object>) Method
Example 




KellermanSoftware.NetDataAccessLayer Namespace > IDataHelper Interface > LoadFromSproc Method : LoadFromSproc<T>(String,Dictionary<String,Object>) Method
Generic class type
The stored procedure name
The parameters to pass to the stored procedure
Load records from a stored procedure and automatically map it to a class
Syntax
Overloads Function LoadFromSproc(Of T As {Class, New})( _
   ByVal storedProcedureName As String, _
   ByVal parameters As Dictionary(Of String,Object) _
) As List(Of T)
Dim instance As IDataHelper
Dim storedProcedureName As String
Dim parameters As Dictionary(Of String,Object)
Dim value As List(Of T)
 
value = instance.LoadFromSproc(Of T)(storedProcedureName, parameters)
List<T> LoadFromSproc<T>( 
   string storedProcedureName,
   Dictionary<string,object> parameters
)
where T: class, new()
List<T*>* LoadFromSproc<T>( 
   string* storedProcedureName,
   Dictionary<string*,Object*>* parameters
) 
where T: ref class, gcnew()
List<T^>^ LoadFromSprocgeneric<typename T>
( 
   String^ storedProcedureName,
   Dictionary<String^,Object^>^ parameters
) 
where T: ref class, gcnew()

Parameters

storedProcedureName
The stored procedure name
parameters
The parameters to pass to the stored procedure

Type Parameters

T
Generic class type

Return Value

A list of objects
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==";
 
//Open the database connection
db.OpenConnection();
 
string storedProcedure = "MonthlyReport";
 
Dictionary<string, object> parameters = new Dictionary<string, object>();
parameters.Add("Month", 6);
 
List<ReportDetail> list = db.LoadFromSproc<ReportDetail>(storedProcedure, parameters);
 
//Close the database connection
db.CloseConnection();
'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=="
 
'Open the database connection
db.OpenConnection()
 
Dim storedProcedure As String = "MonthlyReport"
 
Dim parameters As New Dictionary(Of String, Object)()
parameters.Add("Month", 6)
 
Dim list As List(Of ReportDetail) = db.LoadFromSproc(Of ReportDetail)(storedProcedure, parameters)
 
'Close the database connection
db.CloseConnection()
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