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




KellermanSoftware.NetDataAccessLayer Namespace > DataHelper Class > LoadFromSproc Method : LoadFromSproc(String,Dictionary<String,Object>) Method
The stored procedure to execute
Parameters to pass into the stored procedure
Get a list of records using the passed Stored Procedure
Syntax
Public Overloads Overridable Function LoadFromSproc( _
   ByVal storedProcedure As String, _
   ByVal parameters As Dictionary(Of String,Object) _
) As List(Of Dictionary(Of String,Object))
Dim instance As DataHelper
Dim storedProcedure As String
Dim parameters As Dictionary(Of String,Object)
Dim value As List(Of Dictionary(Of String,Object))
 
value = instance.LoadFromSproc(storedProcedure, parameters)

Parameters

storedProcedure
The stored procedure to execute
parameters
Parameters to pass into the stored procedure

Return Value

A list of dictionary records
Example
//Get the current thread static safe instance of the helper
SqlServerProvider provider = new SqlServerProvider();
 
//Specify User Name and License Key from the receipt, leave blank for trial mode
//db.UserName = "John Smith 1234";
//db.LicenseKey = "asdfl219==";
 
//Log to the console
db.EnableLogging();
 
//Open the database connection
db.OpenConnection();
 
//Parameters
Dictionary<string, object> parameters = new Dictionary<string, object>();
parameters.Add("BeginDate", DateTime.Now.AddYears(-1));
 
string storedProcedure = "GetTopTenCustomers";
 
List<Dictionary<string, object>> records = db.LoadFromSproc(storedProcedure,parameters);
 
db.CloseConnection();
'Get the current thread static safe instance of the helper
Dim provider As New SqlServerProvider()
 
'Specify User Name and License Key from the receipt, leave blank for trial mode
Dim connnectionString As String = "Data Source=TestServer;Initial Catalog=TestDatabase;Integrated Security=SSPI;"
'db.LicenseKey = "asdfl219=="
 
'Log to the console
db.EnableLogging()
 
'Open the database connection
db.OpenConnection()
 
'Parameters
Dim parameters As New Dictionary(Of String, Object)()
parameters.Add("BeginDate", Date.Now.AddYears(-1))
 
Dim storedProcedure As String = "GetTopTenCustomers"
 
Dim records As List(Of Dictionary(Of String, Object)) = db.LoadFromSproc(storedProcedure,parameters)
 
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

DataHelper Class
DataHelper Members
Overload List