Knight Data Access Layer
ExecuteNonQuerySproc(String,List<IDbDataParameter>) Method
Example 




KellermanSoftware.NetDataAccessLayer Namespace > DataHelper Class > ExecuteNonQuerySproc Method : ExecuteNonQuerySproc(String,List<IDbDataParameter>) Method
Name of the stored procedure
The parameters to use for the stored procedure
Execute the passed stored procedure and return the number of affected records. Output parameters will be set on return.
Syntax
Public Overloads Overridable Function ExecuteNonQuerySproc( _
   ByVal storedProcedure As String, _
   ByVal parameters As List(Of IDbDataParameter) _
) As Integer
Dim instance As DataHelper
Dim storedProcedure As String
Dim parameters As List(Of IDbDataParameter)
Dim value As Integer
 
value = instance.ExecuteNonQuerySproc(storedProcedure, parameters)
public virtual int ExecuteNonQuerySproc( 
   string storedProcedure,
   List<IDbDataParameter> parameters
)
public: virtual int ExecuteNonQuerySproc( 
   string* storedProcedure,
   List<IDbDataParameter*>* parameters
) 
public:
virtual int ExecuteNonQuerySproc( 
   String^ storedProcedure,
   List<IDbDataParameter^>^ parameters
) 

Parameters

storedProcedure
Name of the stored procedure
parameters
The parameters to use for the stored procedure
Example
//Get the current instance of the helper 
IDataHelper db = DataHelper.SessionFactory();
 
string storedProcedure = "Insert_Customer";
 
//Parameters
List<IDbDataParameter> parameters = new List<IDbDataParameter>();
IDbDataParameter primaryKeyOutput = new System.Data.SqlClient.SqlParameter("@CustomerId",DbType.Int64);
primaryKeyOutput.Direction = ParameterDirection.Output;
parameters.Add(primaryKeyOutput);
 
int affectedRecords = db.ExecuteNonQuerySproc(storedProcedure, parameters);
 
Console.WriteLine(parameters[0].Value);
'Get the current instance of the helper 
Dim db As IDataHelper = DataHelper.SessionFactory()
 
Dim storedProcedure As String = "Insert_Customer"
 
'Parameters
Dim parameters As New List(Of IDbDataParameter)()
Dim primaryKeyOutput As IDbDataParameter = New System.Data.SqlClient.SqlParameter("@CustomerId",DbType.Int64)
primaryKeyOutput.Direction = ParameterDirection.Output
parameters.Add(primaryKeyOutput)
 
Dim affectedRecords As Integer = db.ExecuteNonQuerySproc(storedProcedure, parameters)
 
Console.WriteLine(parameters(0).Value)
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