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




KellermanSoftware.NetDataAccessLayer Namespace > DataHelper Class > LoadFromSproc Method : LoadFromSproc<T>(String,IEnumerable<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 Function LoadFromSproc(Of T As {Class, New})( _
   ByVal storedProcedureName As String, _
   ByVal nameValueParameters As IEnumerable(Of Object) _
) As List(Of T)
Dim instance As DataHelper
Dim storedProcedureName As String
Dim nameValueParameters As IEnumerable(Of Object)
Dim value As List(Of T)
 
value = instance.LoadFromSproc(Of T)(storedProcedureName, nameValueParameters)
public List<T> LoadFromSproc<T>( 
   string storedProcedureName,
   IEnumerable<object> nameValueParameters
)
where T: class, new()
public: List<T*>* LoadFromSproc<T>( 
   string* storedProcedureName,
   IEnumerable<Object*>* nameValueParameters
) 
where T: ref class, gcnew()
public:
List<T^>^ LoadFromSprocgeneric<typename T>
( 
   String^ storedProcedureName,
   IEnumerable<Object^>^ nameValueParameters
) 
where T: ref class, gcnew()

Parameters

storedProcedureName
The stored procedure to execute
nameValueParameters
Parameters to pass into the stored procedure

Type Parameters

T

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();
 
string storedProcedure = "GetTopTenCustomers";
 
List<Dictionary<string, object>> records = db.LoadFromSproc(storedProcedure,new object[] {"BeginDate", DateTime.Now.AddYears(-1) });
 
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()
 
Dim storedProcedure As String = "GetTopTenCustomers"
 
Dim records As List(Of Dictionary(Of String, Object)) = db.LoadFromSproc(storedProcedure,new object[] {"BeginDate", DateTime.Now.AddYears(-1) })
 
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